[Solved] Set the text colour of a Label


#1

Hi,

 

I'm trying to set the text colour of a Label in a Component but it's not working, here is my code :

UIComponent::UIComponent(Patch *patch) : juce::ImageComponent() {

                juce::String text;


                text = "Dependencies : ";
                text += (int) getDependencies().size();
                _dependenciesLabel = new juce::Label("dependencies label", text);
                _dependenciesLabel->setColour(juce::Label::textColourId, juce::Colour(1.0f, 0.0f, 0.0f));
                addAndMakeVisible (_dependenciesLabel);
                
                text = "Parameters : ";
                text += (int) getParameters().size();
                _parametersLabel = new juce::Label("parameters label", text);
                _parametersLabel->setColour(juce::Label::textColourId, juce::Colour(1.0f, 0.0f, 0.0f));
                addAndMakeVisible (_parametersLabel);
                setSize(300, 300);
}

Any idea of how I could do it ? 

Thank you.


#2

It actually works, I tought that by using the juce::Colour constructor with float the rgb values should between 0 and 1. I changed to juce::Colour(255, 0, 0) and it works as expected.