IntelliJ Themes: fixes for Slider:

- use Component.focusColor if Slider.focusedColor is not set (which is the case in all IntelliJ themes)
- compute hover color based on thumb color
- ignore Slider.trackWidth (used in Material Theme UI Lite)
This commit is contained in:
Karl Tauber
2019-11-24 11:12:16 +01:00
parent 6d86cf8f9c
commit 3ffe8e225d
4 changed files with 11 additions and 9 deletions

View File

@@ -371,6 +371,9 @@ public class IntelliJTheme
uiKeyMapping.put( "ProgressBar.trackColor", "ProgressBar.background" );
uiKeyMapping.put( "ProgressBar.progressColor", "ProgressBar.foreground" );
// Slider
uiKeyMapping.put( "Slider.trackWidth", "" ); // ignore (used in Material Theme UI Lite)
for( Map.Entry<String, String> e : uiKeyMapping.entrySet() )
uiKeyInverseMapping.put( e.getValue(), e.getKey() );

View File

@@ -52,7 +52,7 @@ import com.formdev.flatlaf.util.UIScale;
* @uiDefault Slider.thumbWidth int
* @uiDefault Slider.trackColor Color
* @uiDefault Slider.thumbColor Color
* @uiDefault Slider.focusedColor Color
* @uiDefault Slider.focusedColor Color optional; defaults to Component.focusColor
* @uiDefault Slider.hoverColor Color optional; defaults to Slider.focusedColor
* @uiDefault Slider.disabledForeground Color used for track and thumb is disabled
*
@@ -110,7 +110,7 @@ public class FlatSliderUI
trackColor = UIManager.getColor( "Slider.trackColor" );
thumbColor = UIManager.getColor( "Slider.thumbColor" );
focusColor = UIManager.getColor( "Slider.focusedColor" );
focusColor = FlatUIUtils.getUIColor( "Slider.focusedColor", "Component.focusColor" );
hoverColor = FlatUIUtils.getUIColor( "Slider.hoverColor", focusColor );
disabledForeground = UIManager.getColor( "Slider.disabledForeground" );
}
@@ -201,7 +201,7 @@ public class FlatSliderUI
}
if( coloredTrack != null ) {
g.setColor( slider.hasFocus() ? focusColor : (hover ? hoverColor : thumbColor) );
FlatUIUtils.setColor( g, slider.hasFocus() ? focusColor : (hover ? hoverColor : thumbColor), thumbColor );
((Graphics2D)g).fill( coloredTrack );
}
@@ -211,9 +211,10 @@ public class FlatSliderUI
@Override
public void paintThumb( Graphics g ) {
g.setColor( slider.isEnabled()
FlatUIUtils.setColor( g, slider.isEnabled()
? (slider.hasFocus() ? focusColor : (hover ? hoverColor : thumbColor))
: disabledForeground );
: disabledForeground,
thumbColor );
if( isRoundThumb() )
g.fillOval( thumbRect.x, thumbRect.y, thumbRect.width, thumbRect.height );

View File

@@ -177,8 +177,7 @@ Separator.foreground=515151
Slider.trackColor=646464
Slider.thumbColor=A6A6A6
Slider.tickColor=888888
Slider.focusedColor=@@Component.focusColor
Slider.hoverColor=888888
Slider.hoverColor=darken(15%,autoInverse)
Slider.disabledForeground=4c5052

View File

@@ -184,8 +184,7 @@ Separator.foreground=cdcdcd
Slider.trackColor=c4c4c4
Slider.thumbColor=6e6e6e
Slider.tickColor=888888
Slider.focusedColor=@@Component.focusColor
Slider.hoverColor=999999
Slider.hoverColor=lighten(15%,autoInverse)
Slider.disabledForeground=c0c0c0