macOS themes: support changing accent and highlight colors (issue #497)

This commit is contained in:
Karl Tauber
2022-06-13 22:52:10 +02:00
parent c7bfd2ea82
commit 664f5c98e9
3 changed files with 13 additions and 9 deletions

View File

@@ -88,12 +88,12 @@
@menuBackground = lighten(@background,8%) @menuBackground = lighten(@background,8%)
# selection # selection
@selectionBackground = @nsSelectedContentBackgroundColor @selectionBackground = if(systemColor(accent), shade(spin(systemColor(accent),4),20%), @nsSelectedContentBackgroundColor)
@selectionForeground = @nsSelectedMenuItemTextColor @selectionForeground = @nsSelectedMenuItemTextColor
@selectionInactiveBackground = @nsUnemphasizedSelectedContentBackgroundColor @selectionInactiveBackground = @nsUnemphasizedSelectedContentBackgroundColor
# text selection # text selection
@textSelectionBackground = @nsSelectedTextBackgroundColor @textSelectionBackground = systemColor(highlight,if(systemColor(accent), darken(desaturate(systemColor(accent),60%),10%), @nsSelectedTextBackgroundColor))
@textSelectionForeground = @nsSelectedTextColor @textSelectionForeground = @nsSelectedTextColor
# menu # menu
@@ -101,8 +101,8 @@
@menuItemMargin = 3,11,3,11 @menuItemMargin = 3,11,3,11
# accent colors (blueish) # accent colors (blueish)
@accentColor = @nsControlAccentColor @accentColor = systemColor(accent,@nsControlAccentColor)
@accentFocusColor = @nsKeyboardFocusIndicatorColor @accentFocusColor = if(systemColor(accent), fade(spin(systemColor(accent),-10),50%), @nsKeyboardFocusIndicatorColor)
#---- Button ---- #---- Button ----

View File

@@ -88,12 +88,12 @@
@menuBackground = darken(@background,4%) @menuBackground = darken(@background,4%)
# selection # selection
@selectionBackground = @nsSelectedContentBackgroundColor @selectionBackground = if(systemColor(accent), shade(spin(systemColor(accent),4),10%), @nsSelectedContentBackgroundColor)
@selectionForeground = @nsSelectedMenuItemTextColor @selectionForeground = @nsSelectedMenuItemTextColor
@selectionInactiveBackground = @nsUnemphasizedSelectedContentBackgroundColor @selectionInactiveBackground = @nsUnemphasizedSelectedContentBackgroundColor
# text selection # text selection
@textSelectionBackground = @nsSelectedTextBackgroundColor @textSelectionBackground = systemColor(highlight,if(systemColor(accent), tint(systemColor(accent),70%), @nsSelectedTextBackgroundColor))
@textSelectionForeground = @foreground @textSelectionForeground = @foreground
# menu # menu
@@ -102,8 +102,8 @@
@menuItemMargin = 3,11,3,11 @menuItemMargin = 3,11,3,11
# accent colors (blueish) # accent colors (blueish)
@accentColor = @nsControlAccentColor @accentColor = systemColor(accent,@nsControlAccentColor)
@accentFocusColor = @nsKeyboardFocusIndicatorColor @accentFocusColor = if(systemColor(accent), fade(spin(systemColor(accent),4),50%), @nsKeyboardFocusIndicatorColor)
#---- Button ---- #---- Button ----

View File

@@ -44,6 +44,8 @@ import com.formdev.flatlaf.extras.FlatUIDefaultsInspector;
import com.formdev.flatlaf.extras.components.FlatButton; import com.formdev.flatlaf.extras.components.FlatButton;
import com.formdev.flatlaf.extras.components.FlatButton.ButtonType; import com.formdev.flatlaf.extras.components.FlatButton.ButtonType;
import com.formdev.flatlaf.icons.FlatAbstractIcon; import com.formdev.flatlaf.icons.FlatAbstractIcon;
import com.formdev.flatlaf.themes.FlatMacDarkLaf;
import com.formdev.flatlaf.themes.FlatMacLightLaf;
import com.formdev.flatlaf.extras.FlatSVGUtils; import com.formdev.flatlaf.extras.FlatSVGUtils;
import com.formdev.flatlaf.ui.FlatUIUtils; import com.formdev.flatlaf.ui.FlatUIUtils;
import com.formdev.flatlaf.ui.JBRCustomDecorations; import com.formdev.flatlaf.ui.JBRCustomDecorations;
@@ -455,7 +457,9 @@ class DemoFrame
lafClass == FlatLightLaf.class || lafClass == FlatLightLaf.class ||
lafClass == FlatDarkLaf.class || lafClass == FlatDarkLaf.class ||
lafClass == FlatIntelliJLaf.class || lafClass == FlatIntelliJLaf.class ||
lafClass == FlatDarculaLaf.class; lafClass == FlatDarculaLaf.class ||
lafClass == FlatMacLightLaf.class ||
lafClass == FlatMacDarkLaf.class;
accentColorLabel.setVisible( isAccentColorSupported ); accentColorLabel.setVisible( isAccentColorSupported );
for( int i = 0; i < accentColorButtons.length; i++ ) for( int i = 0; i < accentColorButtons.length; i++ )