Turn the light out and allow it to cool because you need to remove the bulb to properly recover the cap.
Twist the bulb out of the fixture with your fingers or attach a piece of duct tape to the bulb and twist it out using the tape as a handle if you can't get your fingers into the fixture.
Replace the bulb with a colored one if you want the cap to be recolored by the light itself. Another option is to cut a light gel with scissors so it fits the bulb and tape it in place. This also creates a colored effect that colors the cap when the light is on.
Pop out the cap if you want to permanently recolor it. Some types twist out while others can be pulled out carefully.
Paint the cap using a heat-resistant paint and a small paintbrush. The heat-resistant paint helps prevent melting or fire risk when it's close to a light for an extended period of time.