From 2b640e2129b652fac7ef1dfd4dc14952295113ac Mon Sep 17 00:00:00 2001 From: Karl Tauber Date: Fri, 4 Aug 2023 00:59:41 +0200 Subject: [PATCH] IntelliJ Themes: fixed foreground colors of disabled text in "Vuesion" theme --- CHANGELOG.md | 1 + .../com/formdev/flatlaf/IntelliJTheme.java | 29 +++++++++++++++++++ .../flatlaf/IntelliJTheme$ThemeLaf.properties | 3 ++ 3 files changed, 33 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7482b86f..e69a9158 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,6 +33,7 @@ FlatLaf Change Log not visible. (issue #686) - "Monocai" theme: Fixed unreadable text color of default buttons. (issue #693) + - "Vuesion" theme: Fixed foreground colors of disabled text. - CheckBox and RadioButton: Fixed unselected icon colors for themes "Atom One Light", "Cyan Light", "GitHub", "Light Owl", "Material Lighter" and "Solarized Light". diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/IntelliJTheme.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/IntelliJTheme.java index 239581cc..bc7c4c15 100644 --- a/flatlaf-core/src/main/java/com/formdev/flatlaf/IntelliJTheme.java +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/IntelliJTheme.java @@ -28,10 +28,12 @@ import java.util.Collections; import java.util.Enumeration; import java.util.HashMap; import java.util.HashSet; +import java.util.Iterator; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Set; +import java.util.Map.Entry; import javax.swing.UIDefaults; import javax.swing.plaf.ColorUIResource; import com.formdev.flatlaf.json.Json; @@ -256,6 +258,33 @@ public class IntelliJTheme if( rowHeight > 22 ) defaults.put( "Tree.rowHeight", 22 ); + // get (and remove) theme specific wildcard replacements, which override all other defaults that end with same suffix + HashMap wildcards = new HashMap<>(); + Iterator> it = themeSpecificDefaults.entrySet().iterator(); + while( it.hasNext() ) { + Entry e = it.next(); + String key = (String) e.getKey(); + if( key.startsWith( "*." ) ) { + wildcards.put( key.substring( "*.".length() ), e.getValue() ); + it.remove(); + } + } + + // override UI defaults with theme specific wildcard replacements + if( !wildcards.isEmpty() ) { + for( Object key : defaults.keySet() ) { + int dot; + if( !(key instanceof String) || + (dot = ((String)key).lastIndexOf( '.' )) < 0 ) + continue; + + String wildcardKey = ((String)key).substring( dot + 1 ); + Object wildcardValue = wildcards.get( wildcardKey ); + if( wildcardValue != null ) + defaults.put( key, wildcardValue ); + } + } + // apply theme specific UI defaults at the end to allow overwriting for( Map.Entry e : themeSpecificDefaults.entrySet() ) { Object key = e.getKey(); diff --git a/flatlaf-core/src/main/resources/com/formdev/flatlaf/IntelliJTheme$ThemeLaf.properties b/flatlaf-core/src/main/resources/com/formdev/flatlaf/IntelliJTheme$ThemeLaf.properties index 8665b3be..ef405637 100644 --- a/flatlaf-core/src/main/resources/com/formdev/flatlaf/IntelliJTheme$ThemeLaf.properties +++ b/flatlaf-core/src/main/resources/com/formdev/flatlaf/IntelliJTheme$ThemeLaf.properties @@ -246,6 +246,9 @@ ToggleButton.endBackground = $ToggleButton.background [Spacegray]TextField.background = @ijTextBackgroundL4 +[vuesion-theme]*.disabledForeground = #8C8C8C +[vuesion-theme]*.disabledText = #8C8C8C +[vuesion-theme]*.inactiveForeground = #8C8C8C [vuesion-theme]Component.accentColor = lazy(Button.default.endBackground) [vuesion-theme]MenuItem.checkBackground = @ijMenuCheckBackgroundL10 [vuesion-theme]MenuItem.underlineSelectionCheckBackground = @ijMenuCheckBackgroundL10