mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2025-12-07 22:40:53 +03:00
UIDefaultsDump: output base color used for resolving derived color
This commit is contained in:
@@ -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).
|
||||
|
||||
@@ -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 );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user