# Selected text colour

**URL:** <https://forum.juce.com/t/selected-text-colour/7806>\
**Category:** General JUCE discussion\
**Created:** [December 2, 2011, 3:36am UTC](https://forum.juce.com/t/selected-text-colour/7806 "2011-12-02T03:36:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![AaronLeese](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/aaronleese/32/624_2.png) [@AaronLeese](https://forum.juce.com/u/AaronLeese)\
**Post date:** [December 2, 2011, 3:36am UTC](https://forum.juce.com/t/selected-text-colour/7806/1 "2011-12-02T03:36:19Z")

</div>

Hey Jules -

What dictates the colour of highlighted texts?

I recently settled on black backgrounds for the labels in a project … but when the text is highlighted it is also black … clearly no good.

Is there a way to specify the text and background colours for “allSelectedText” or something like it ?

---

<div class="post-metadata">

**Author:** ![ckk](https://avatars.discourse-cdn.com/v4/letter/c/d26b3c/32.png) [@ckk](https://forum.juce.com/u/ckk)\
**Post date:** [December 2, 2011, 7:20am UTC](https://forum.juce.com/t/selected-text-colour/7806/2 "2011-12-02T07:20:04Z")

</div>

If you edit a label, it shows a texteditor. So you probably need to set the TextEditor::highlightedTextColourId colour.

Chris

---

<div class="post-metadata">

**Author:** ![AaronLeese](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/aaronleese/32/624_2.png) [@AaronLeese](https://forum.juce.com/u/AaronLeese)\
**Post date:** [December 2, 2011, 5:56pm UTC](https://forum.juce.com/t/selected-text-colour/7806/3 "2011-12-02T17:56:46Z")

</div>

Ah! Of course - can’t believe I didn’t think of that.

However - I also notice that the constructor for Labels hard codes a few colours:

[code]  
Label::Label (const String& name,  
const String& labelText) : …  
{  
setColour (TextEditor::textColourId, Colours::black);  
setColour (TextEditor::backgroundColourId, Colours::transparentBlack);  
setColour (TextEditor::outlineColourId, Colours::transparentBlack);

```
textValue.addListener (this);

```

}[/code]

So that you then need to individually set the colour for the label, instead of being able to use the lookAndFeel default colors.

Wouldn’t it be better to have this constructor look up the default textColourId instead of using black?
