# \[Solved\] Set the text colour of a Label

**URL:** <https://forum.juce.com/t/solved-set-the-text-colour-of-a-label/12632>\
**Category:** General JUCE discussion\
**Created:** [March 31, 2014, 2:23pm UTC](https://forum.juce.com/t/solved-set-the-text-colour-of-a-label/12632 "2014-03-31T14:23:27Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![paularthur-sauvageot](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/paularthur-sauvageot/32/172_2.png) [@paularthur-sauvageot](https://forum.juce.com/u/paularthur-sauvageot)\
**Post date:** [March 31, 2014, 2:23pm UTC](https://forum.juce.com/t/solved-set-the-text-colour-of-a-label/12632/1 "2014-03-31T14:23:27Z")

</div>

Hi,

&nbsp;

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()&nbsp;{
> 
> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;juce::String text;
> 
> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;text = "Dependencies : ";  
> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;text += (int) getDependencies().size();  
> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;\_dependenciesLabel = new juce::Label("dependencies label", text);  
> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;\_dependenciesLabel-\>setColour(juce::Label::textColourId, juce::Colour(1.0f, 0.0f, 0.0f));  
> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;addAndMakeVisible (\_dependenciesLabel);  
> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;  
> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;text = "Parameters : ";  
> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;text += (int) getParameters().size();  
> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;\_parametersLabel = new juce::Label("parameters label", text);  
> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;\_parametersLabel-\>setColour(juce::Label::textColourId, juce::Colour(1.0f, 0.0f, 0.0f));  
> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;addAndMakeVisible (\_parametersLabel);  
> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;setSize(300, 300);  
> }

Any idea of how I could do it ?&nbsp;

Thank you.

---

<div class="post-metadata">

**Author:** ![paularthur-sauvageot](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/paularthur-sauvageot/32/172_2.png) [@paularthur-sauvageot](https://forum.juce.com/u/paularthur-sauvageot)\
**Post date:** [March 31, 2014, 2:59pm UTC](https://forum.juce.com/t/solved-set-the-text-colour-of-a-label/12632/2 "2014-03-31T14:59:49Z")

</div>

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.
