I have build a musicbox with an rpi 3+ and added a power button and 2 buttons to turn the volume up and down.

The buttons have LED lighting, I have connected them to GPIO pins but this results in them being turned on all the time even if the pi is turned off. Power button is connected to pin 5 and 6 and then for the led power on the button is connected to ground and 5v pin.

Is there a way to setup the GPIO pins so the lighting only turns on when the pi is on? Thinking of some kind of code for the GPIO pins