How can I change the text color of a BS5 label?

Hi

I’ve seen this question answered for BS4 by removing the class of the label first to free it from class styling and then add the color you want.

Is this still the only way to do it? Or is there a ‘proper’ way to change the color of a label?

Thanks

Would this work for you?

Label1.style.backgroundColor = "blue"

Nope, didn’t work. I’m actually trying to change the color of the text, but that command didn’t change the background color either. :man_shrugging:

Sorry - I misread the property you want to change.

Try this:

Label1.style.setProperty("color", "blue", "important")

I’m not sure why the backgroundColor didn’t change for you - it’s what I am doing here.

Hi George, it must have been a glitch or something because I had tried that by entering

color: red !important;

in the ‘style’ field and it did nothing, but having restarted AppStudio, it now works, so I have no idea why it didn’t work before.

Oh, and the background color is now also working, so must have been a glitch. Must remember to restart AppStudio and try again next time before reporting it here.

Thanks for that.

Yes, that’s the right thing to do.