How to change LED color by flight mode

I want to change the LED color for each flight mode like DJI ,
using the Copter 3.4.6 stabilization version. How can I do this?

There may be other ways, but you could set Servo6 function to “55” which would provide the MODE signal (usually channel 5 in a quad setup) to that output and then use a very small microcontroller (Teensy3.2 is my favorite) to decode the PWM values and control your lights. You would probably want to boost the current to the LEDs with transistors, since the microcontroller can only provide about 20mA on each output.