How to make a slider label have rounded corners


I actually posted a link called LookAndFeel_V2, if you’d clicked it it would have brought you to the source in github, here inlined for your convenience:

…click it… :wink:


@daniel How do you do the inline github link out of interest?


Just click on a line number in github, copy that URL onto a separate line. The rest happens automatically…


This is what i have now. but the border is still black (i want white) and i want the text to show in white but i think im doing it wrong aha.

class CustomLAF : public juce::LookAndFeel_V4
	void drawLabel(Graphics& g, Label& label)override {
    		g.drawRoundedRectangle(0, 0, 75, 30, 10, 3);
    		g.fillRoundedRectangle(label.getLocalBounds().toFloat(), 5);

		if (!label.isBeingEdited())
			auto alpha = label.isEnabled() ? 1.0f : 0.5f;
			const Font font(getLabelFont(label));




a) don’t use fixed numbers in the LnF, since the component could be of a different size. Use the numbers label.getLocalBounds() returns instead.
b) call the drawRoundedRectangle() last, since all painting paints over the previous call
c) to set the colours, there is a ColourId -> Colour map in the lookAndFeel, hence you can call e.g. otherLookAndFeel.setColour (Label::outlineColourId, Colours::white); and it will be used in all Labels you set the lookAndFeel to