Many commercially produced locos have bulbs or LEDs to illuminate the headlamps and tail lamps. Modern LED equipped locos usually now have bicolour LEDs to change between red and white depending upon the direction of the loco, but many don’t and just have a single colour LED or lamp that shows white only in the direction of travel.
I am now equipping some of my locos with bicolour white/red LEDs so that they correctly show front and rear white and red lighting when commanded by the DCC chips. These can be a little fiddly to wire up in the confined spaces in some locos but is well worth doing.
For 3-wire common anode bicolour LEDs you can use this layout to replace a single bulb at each end loco. 3mm bicolour domed LEDs fit in place of most filament bulbs used in locos such as Bemo.
For locos with multiple bulbs at each end you can use this circuit to replace the 12v DC bulbs with 4 wire bicolour LEDs.