diff --git a/flatlaf-extras/src/main/resources/com/formdev/flatlaf/extras/resources/DerivedColorKeys.properties b/flatlaf-extras/src/main/resources/com/formdev/flatlaf/extras/resources/DerivedColorKeys.properties index f26977df..0e2e4e68 100644 --- a/flatlaf-extras/src/main/resources/com/formdev/flatlaf/extras/resources/DerivedColorKeys.properties +++ b/flatlaf-extras/src/main/resources/com/formdev/flatlaf/extras/resources/DerivedColorKeys.properties @@ -21,8 +21,9 @@ # a variable base color (usually the current background color of a component). # This works only for a limited set of UI keys. # -# The property key is the UI key of a color, which is computed at runtime. -# The property value is the UI key of the base color. +# In this properties file: +# - The property key is the UI key of a color, which is computed at runtime. +# - The property value is the UI key of the base color. # # This file is not used at runtime. # It is only used in tooling (e.g. UI Defaults Inspector or UIDefaultsDump). diff --git a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/uidefaults/UIDefaultsDump.java b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/uidefaults/UIDefaultsDump.java index 460df2f9..12a0ea2c 100644 --- a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/uidefaults/UIDefaultsDump.java +++ b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/uidefaults/UIDefaultsDump.java @@ -458,12 +458,14 @@ public class UIDefaultsDump } private void dumpColor( PrintWriter out, String key, Color color ) { - Color resolvedColor = resolveDerivedColor( key, color ); + Color[] retBaseColor = new Color[1]; + Color resolvedColor = resolveDerivedColor( key, color, retBaseColor ); if( resolvedColor != color && resolvedColor.getRGB() != color.getRGB() ) { if( !isIntelliJTheme ) { System.err.println( "Key '" + key + "': derived colors not equal" ); - System.err.println( " Default color: " + dumpColorHexAndHSL( color ) ); - System.err.println( " Resolved color: " + dumpColorHexAndHSL( resolvedColor ) ); + System.err.println( " Default color: " + dumpColorHexAndHSL( color ) ); + System.err.println( " Resolved color: " + dumpColorHexAndHSL( resolvedColor ) ); + System.err.println( " Base of resolved color: " + dumpColorHexAndHSL( retBaseColor[0] ) ); } out.printf( "%s / ", @@ -672,7 +674,7 @@ public class UIDefaultsDump return properties; } - private Color resolveDerivedColor( String key, Color color ) { + private Color resolveDerivedColor( String key, Color color, Color[] retBaseColor ) { if( !(color instanceof DerivedColor) ) return color; @@ -693,7 +695,9 @@ public class UIDefaultsDump throw new IllegalStateException( "Missing base color '" + baseKey + "' for key '" + key + "'." ); if( baseColor instanceof DerivedColor ) - baseColor = resolveDerivedColor( (String) baseKey, baseColor ); + baseColor = resolveDerivedColor( (String) baseKey, baseColor, retBaseColor ); + + retBaseColor[0] = baseColor; Color newColor = FlatUIUtils.deriveColor( color, baseColor );