@@ -184,30 +184,33 @@ void TextBoxParameterEditor::resized()
184184 updateBounds ();
185185}
186186
187- void CustomToggleButton::paintButton (juce::Graphics& g, bool shouldDrawButtonAsHighlighted , bool shouldDrawButtonAsDown )
187+ void CustomToggleButton::paintButton (juce::Graphics& g, bool isMouseOver , bool isButtonDown )
188188{
189- // Set the colour based on the button state
189+ Colour backgroundColour = findColour (ThemeColours::widgetBackground);
190+
190191 if (getToggleState ())
191192 {
192- g.setColour (findColour (ThemeColours::highlightedFill));
193- }
194- else
195- {
196- g.setColour (findColour (ThemeColours::defaultFill));
193+ backgroundColour = findColour (ThemeColours::highlightedFill);
197194 }
198195
199- // Draw a rounded rectangle
200- g. fillRoundedRectangle ( getLocalBounds (). toFloat (), 3 .0f );
196+ auto baseColour = backgroundColour. withMultipliedSaturation ( hasKeyboardFocus ( true ) ? 1 . 3f : 1 . 0f )
197+ . withMultipliedAlpha ( isEnabled () ? 1 .0f : 0 . 5f );
201198
202- // Set the text colour
203- g. setColour ( findColour (ThemeColours::outline) );
199+ if (isButtonDown || isMouseOver)
200+ baseColour = baseColour. contrasting (isButtonDown ? 0 . 2f : 0 . 05f );
204201
205- // Draw a rounded rectangle border
206- g.drawRoundedRectangle (getLocalBounds ().toFloat (), 3 .0f , 1 .0f );
202+ g.setColour (baseColour);
203+ g.fillRoundedRectangle (getLocalBounds ().toFloat ().reduced (0 .5f ), 3 .0f );
204+
205+ g.setColour (findColour (ThemeColours::outline).withAlpha (isEnabled () ? 1 .0f : 0 .5f ));
206+ g.drawRoundedRectangle (getLocalBounds ().toFloat ().reduced (0 .5f ), 3 .0f , 1 .0f );
207207
208- // Set the text font
209208 g.setFont (FontOptions (" Inter" , " Regular" , int (0.75 * getHeight ())));
210- g.setColour (findColour (ThemeColours::defaultText));
209+
210+ if (! isEnabled () || isButtonDown)
211+ g.setColour (findColour (ThemeColours::defaultText).withAlpha (0 .4f ));
212+ else
213+ g.setColour (findColour (ThemeColours::defaultText));
211214
212215 // Set the text based on the button state
213216 if (getToggleState ())
0 commit comments