UI defaults inspector: round HSL values (as also done in theme editor)

This commit is contained in:
Karl Tauber
2021-08-05 18:49:03 +02:00
parent 02b1ba2926
commit 3f5acda132

View File

@@ -700,16 +700,16 @@ public class FlatUIDefaultsInspector
if( value instanceof Color ) { if( value instanceof Color ) {
Color color = (info instanceof Color[]) ? ((Color[])info)[0] : (Color) value; Color color = (info instanceof Color[]) ? ((Color[])info)[0] : (Color) value;
HSLColor hslColor = new HSLColor( color ); HSLColor hslColor = new HSLColor( color );
int hue = Math.round( hslColor.getHue() );
int saturation = Math.round( hslColor.getSaturation() );
int luminance = Math.round( hslColor.getLuminance() );
if( color.getAlpha() == 255 ) { if( color.getAlpha() == 255 ) {
return String.format( "%-9s HSL %3d %3d %3d", return String.format( "%-9s HSL %3d %3d %3d",
color2hex( color ), color2hex( color ), hue, saturation, luminance );
(int) hslColor.getHue(), (int) hslColor.getSaturation(),
(int) hslColor.getLuminance() );
} else { } else {
int alpha = Math.round( hslColor.getAlpha() * 100 );
return String.format( "%-9s HSL %3d %3d %3d %2d", return String.format( "%-9s HSL %3d %3d %3d %2d",
color2hex( color ), color2hex( color ), hue, saturation, luminance, alpha );
(int) hslColor.getHue(), (int) hslColor.getSaturation(),
(int) hslColor.getLuminance(), (int) (hslColor.getAlpha() * 100) );
} }
} else if( value instanceof Insets ) { } else if( value instanceof Insets ) {
Insets insets = (Insets) value; Insets insets = (Insets) value;