Skip to content

Commit

Permalink
CheckBox: fixed colors in light IntelliJ themes (issue #126)
Browse files Browse the repository at this point in the history
  • Loading branch information
DevCharly committed Jul 10, 2020
1 parent c232de1 commit 82294b6
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ FlatLaf Change Log
- Custom window decorations: Center title if menu bar is embedded.
- Custom window decorations: Cursor of components (e.g. TextField) was not
changed. (issue #125)
- CheckBox: Fixed colors in light IntelliJ themes. (issue #126)
- InternalFrame: Use default icon in internal frames. (issue #122)


Expand Down
15 changes: 15 additions & 0 deletions flatlaf-core/src/main/java/com/formdev/flatlaf/IntelliJTheme.java
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,10 @@ private void applyCheckBoxColors( UIDefaults defaults ) {

String newKey = checkboxKeyMapping.get( key );
if( newKey != null ) {
String checkBoxIconPrefix = "CheckBox.icon.";
if( !dark && newKey.startsWith( checkBoxIconPrefix ) )
newKey = "CheckBox.icon[filled].".concat( newKey.substring( checkBoxIconPrefix.length() ) );

ColorUIResource color = toColor( (String) value );
if( color != null ) {
defaults.put( newKey, color );
Expand Down Expand Up @@ -444,12 +448,23 @@ private void applyCheckBoxColors( UIDefaults defaults ) {

// remove hover and pressed colors
if( checkboxModified ) {
defaults.remove( "CheckBox.icon.focusWidth" );
defaults.remove( "CheckBox.icon.hoverBorderColor" );
defaults.remove( "CheckBox.icon.focusedBackground" );
defaults.remove( "CheckBox.icon.hoverBackground" );
defaults.remove( "CheckBox.icon.pressedBackground" );
defaults.remove( "CheckBox.icon.selectedFocusedBackground" );
defaults.remove( "CheckBox.icon.selectedHoverBackground" );
defaults.remove( "CheckBox.icon.selectedPressedBackground" );

defaults.remove( "CheckBox.icon[filled].focusWidth" );
defaults.remove( "CheckBox.icon[filled].hoverBorderColor" );
defaults.remove( "CheckBox.icon[filled].focusedBackground" );
defaults.remove( "CheckBox.icon[filled].hoverBackground" );
defaults.remove( "CheckBox.icon[filled].pressedBackground" );
defaults.remove( "CheckBox.icon[filled].selectedFocusedBackground" );
defaults.remove( "CheckBox.icon[filled].selectedHoverBackground" );
defaults.remove( "CheckBox.icon[filled].selectedPressedBackground" );
}

// copy values
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ Button.default.borderWidth=1
#---- CheckBox ----

CheckBox.icon.style=filled
CheckBox.icon[filled].focusWidth=2


#---- Component ----
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@

+ CheckBox.icon.style filled

+ CheckBox.icon[filled].focusWidth 2

- CheckBox.icon[filled].selectedFocusedCheckmarkColor #e3f1fa javax.swing.plaf.ColorUIResource [UI]

- ComboBox.border [lazy] 1,1,1,1 false com.formdev.flatlaf.ui.FlatRoundBorder [UI]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ CheckBox.icon.selectedFocusedBorderColor
CheckBox.icon.style
CheckBox.iconTextGap
CheckBox.icon[filled].checkmarkColor
CheckBox.icon[filled].focusWidth
CheckBox.icon[filled].selectedBackground
CheckBox.icon[filled].selectedBorderColor
CheckBox.icon[filled].selectedFocusedBackground
Expand Down

0 comments on commit 82294b6

Please sign in to comment.