editor.setColour(TextEditor::outlineColourId, Colours::red); // non-transparent red
editor.setColour(TextEditor::outlineColourId, Colours::red.withAlpha(0.0f)); // transparent red
“Alpha” will be the same as “transparency” for colours
Great thanks, I tried that already, and it doesn’t work so I suppose it’s some problem with my lookAndFeelMethod in which I have method like that:
Label* createSliderTextBox(Slider &slider) override
{
auto l = new SliderLabel();
l->setJustificationType(Justification::centred);
l->setKeyboardType(TextInputTarget::decimalKeyboard);
l->setColour(Label::textColourId, slider.findColour(Slider::textBoxTextColourId));
l->setColour(Label::outlineColourId, myColour);
// ALL ABOVE WORKS
// BUT THAT DOESN"T WORK:
l->setColour(TextEditor::outlineColourId, Colours::black.withAlpha(1.0f));
// NO MATTER WHAT COLOUR I USE THE OUTLINE OF TEXT EDITOR IS ALWAYS THE SAME.
}
I also wonder how to change the thickness of Label and TextEditor outlines.
Components are only going to use the ColourIds associated with them generally, which is why Label::outlineColourId works and TextEditor::outlineColourId does not, and the default LookAndFeel doesn’t seem to try inheriting any ColourIds from parents in this case:
You’ll want to override that LookAndFeel maybe just use the same code but use findColour(..., true); inside those setColour() methods… the boolean argument tells findColour() that it should search the parent component as well