IntelliJ Themes:

- fixed menu item check colors
- fixed MenuItem.underlineSelectionColor
- fixed List, Tree and Table selectionInactiveForeground in light Arc themes
- fixed List and Table background colors in Material UI Lite themes
This commit is contained in:
Karl Tauber
2021-01-13 10:11:29 +01:00
parent ccbb26c176
commit a6db352ecd
10 changed files with 157 additions and 13 deletions

View File

@@ -29,6 +29,12 @@ FlatLaf Change Log
`com.formdev.flatlaf.extras.components` to Java 9 module descriptor.
- JIDE Common Layer: Invoke `LookAndFeelFactory.installJideExtension()` when
using FlatLaf UI delegates. (issue #230)
- IntelliJ Themes:
- Fixed menu item check colors.
- Fixed `MenuItem.underlineSelectionColor`.
- Fixed List, Tree and Table `selectionInactiveForeground` in light Arc
themes.
- Fixed List and Table background colors in Material UI Lite themes.
## 0.46

View File

@@ -57,6 +57,8 @@ public class IntelliJTheme
public final boolean dark;
public final String author;
private final boolean isMaterialUILite;
private final Map<String, String> colors;
private final Map<String, Object> ui;
private final Map<String, Object> icons;
@@ -120,6 +122,8 @@ public class IntelliJTheme
dark = Boolean.parseBoolean( (String) json.get( "dark" ) );
author = (String) json.get( "author" );
isMaterialUILite = author.equals( "Mallowigi" );
colors = (Map<String, String>) json.get( "colors" );
ui = (Map<String, Object>) json.get( "ui" );
icons = (Map<String, Object>) json.get( "icons" );
@@ -211,6 +215,12 @@ public class IntelliJTheme
if( !uiKeys.contains( "ToggleButton.foreground" ) && uiKeys.contains( "Button.foreground" ) )
defaults.put( "ToggleButton.foreground", defaults.get( "Button.foreground" ) );
// fix List and Table background colors in Material UI Lite themes
if( isMaterialUILite ) {
defaults.put( "List.background", defaults.get( "Tree.background" ) );
defaults.put( "Table.background", defaults.get( "Tree.background" ) );
}
// limit tree row height
int rowHeight = defaults.getInt( "Tree.rowHeight" );
if( rowHeight > 22 )
@@ -231,10 +241,17 @@ public class IntelliJTheme
// remove theme specific UI defaults and remember only those for current theme
Map<Object, Object> themeSpecificDefaults = new HashMap<>();
String currentThemePrefix = '[' + name.replace( ' ', '_' ) + ']';
String currentAuthorPrefix = "[author-" + author.replace( ' ', '_' ) + ']';
String allThemesPrefix = "[*]";
String[] prefixes = { currentThemePrefix, currentAuthorPrefix, allThemesPrefix };
for( String key : themeSpecificKeys ) {
Object value = defaults.remove( key );
if( key.startsWith( currentThemePrefix ) )
themeSpecificDefaults.put( key.substring( currentThemePrefix.length() ), value );
for( String prefix : prefixes ) {
if( key.startsWith( prefix ) ) {
themeSpecificDefaults.put( key.substring( prefix.length() ), value );
break;
}
}
}
return themeSpecificDefaults;
@@ -275,7 +292,6 @@ public class IntelliJTheme
uiKeys.add( key );
// fix ComboBox size and Spinner border in all Material UI Lite themes
boolean isMaterialUILite = author.equals( "Mallowigi" );
if( isMaterialUILite && (key.equals( "ComboBox.padding" ) || key.equals( "Spinner.border" )) )
return; // ignore
@@ -529,6 +545,7 @@ public class IntelliJTheme
uiKeyCopying.put( "CheckBoxMenuItem.margin", "MenuItem.margin" );
uiKeyCopying.put( "RadioButtonMenuItem.margin", "MenuItem.margin" );
uiKeyMapping.put( "PopupMenu.border", "PopupMenu.borderInsets" );
uiKeyCopying.put( "MenuItem.underlineSelectionColor", "TabbedPane.underlineColor" );
// IDEA uses List.selectionBackground also for menu selection
uiKeyCopying.put( "Menu.selectionBackground", "List.selectionBackground" );

View File

@@ -57,6 +57,7 @@ import com.formdev.flatlaf.util.SystemInfo;
* @uiDefault MenuItem.underlineSelectionCheckBackground Color
* @uiDefault MenuItem.underlineSelectionColor Color
* @uiDefault MenuItem.underlineSelectionHeight int
* @uiDefault MenuItem.selectionBackground Color
*
* @author Karl Tauber
*/
@@ -82,6 +83,8 @@ public class FlatMenuItemRenderer
protected final Color underlineSelectionColor = UIManager.getColor( "MenuItem.underlineSelectionColor" );
protected final int underlineSelectionHeight = UIManager.getInt( "MenuItem.underlineSelectionHeight" );
protected final Color selectionBackground = UIManager.getColor( "MenuItem.selectionBackground" );
protected FlatMenuItemRenderer( JMenuItem menuItem, Icon checkIcon, Icon arrowIcon,
Font acceleratorFont, String acceleratorDelimiter )
{
@@ -303,7 +306,7 @@ debug*/
// then use filled icon background to indicate selection (instead of using checkIcon)
if( menuItem.isSelected() && checkIcon != null && icon != checkIcon ) {
Rectangle r = FlatUIUtils.addInsets( iconRect, scale( checkMargins ) );
g.setColor( deriveBackground( checkBackground ) );
g.setColor( FlatUIUtils.deriveColor( checkBackground, selectionBackground ) );
g.fillRect( r.x, r.y, r.width, r.height );
}

View File

@@ -30,7 +30,7 @@
@textComponentBackground = #45494A
@menuBackground = darken(@background,5%)
@menuHoverBackground = lighten(@menuBackground,10%,derived)
@menuCheckBackground = darken(@selectionBackground,10%)
@menuCheckBackground = darken(@selectionBackground,10%,derived noAutoInverse)
@menuAcceleratorForeground = darken(@foreground,15%)
@menuAcceleratorSelectionForeground = @selectionForeground
@cellFocusColor = #000

View File

@@ -30,7 +30,7 @@
@textComponentBackground = #fff
@menuBackground = #fff
@menuHoverBackground = darken(@menuBackground,10%,derived)
@menuCheckBackground = lighten(@selectionBackground,40%)
@menuCheckBackground = lighten(@selectionBackground,40%,derived noAutoInverse)
@menuAcceleratorForeground = lighten(@foreground,30%)
@menuAcceleratorSelectionForeground = @selectionForeground
@cellFocusColor = #000

View File

@@ -35,6 +35,13 @@ Button.default.hoverBorderColor = null
HelpButton.hoverBorderColor = null
#---- MenuItemCheckBox ----
# colors from intellij/checkmark.svg and darcula/checkmark.svg
[light]MenuItemCheckBox.icon.checkmarkColor=#3E3E3C
[dark]MenuItemCheckBox.icon.checkmarkColor=#fff9
#---- Slider ----
Slider.focusedColor = fade($Component.focusColor,40%,derived)
@@ -50,11 +57,21 @@ ToggleButton.endBackground = $ToggleButton.background
#---- theme specific ----
@ijMenuCheckBackgroundL10 = lighten(@selectionBackground,10%,derived noAutoInverse)
@ijMenuCheckBackgroundL20 = lighten(@selectionBackground,20%,derived noAutoInverse)
@ijMenuCheckBackgroundD10 = darken(@selectionBackground,10%,derived noAutoInverse)
[Arc_Theme]ProgressBar.selectionBackground = #000
[Arc_Theme]ProgressBar.selectionForeground = #fff
[Arc_Theme]List.selectionInactiveForeground = #fff
[Arc_Theme]Table.selectionInactiveForeground = #fff
[Arc_Theme]Tree.selectionInactiveForeground = #fff
[Arc_Theme_-_Orange]ProgressBar.selectionBackground = #000
[Arc_Theme_-_Orange]ProgressBar.selectionForeground = #fff
[Arc_Theme_-_Orange]List.selectionInactiveForeground = #fff
[Arc_Theme_-_Orange]Table.selectionInactiveForeground = #fff
[Arc_Theme_-_Orange]Tree.selectionInactiveForeground = #fff
[Arc_Theme_Dark]ProgressBar.selectionBackground = #ddd
[Arc_Theme_Dark]ProgressBar.selectionForeground = #ddd
@@ -64,18 +81,28 @@ ToggleButton.endBackground = $ToggleButton.background
[Cobalt_2]CheckBox.icon.background = #002946
[Cobalt_2]CheckBox.icon.checkmarkColor = #002946
[Cobalt_2]MenuItem.checkBackground = @ijMenuCheckBackgroundL10
[Cobalt_2]MenuItem.underlineSelectionCheckBackground = @ijMenuCheckBackgroundL10
[Cyan_light]MenuItem.checkBackground = @ijMenuCheckBackgroundL20
[Cyan_light]MenuItem.underlineSelectionCheckBackground = @ijMenuCheckBackgroundL20
[Dark_purple]Slider.focusedColor = fade($Component.focusColor,70%,derived)
[Dracula]ProgressBar.selectionBackground = #fff
[Dracula]ProgressBar.selectionForeground = #fff
[Gradianto_Dark_Fuchsia]MenuItem.checkBackground = @ijMenuCheckBackgroundL10
[Gradianto_Dark_Fuchsia]MenuItem.underlineSelectionCheckBackground = @ijMenuCheckBackgroundL10
[Gruvbox_Dark_Hard]ToggleButton.selectedBackground = $ToggleButton.selectedBackground
[Gruvbox_Dark_Hard]ToggleButton.toolbar.selectedBackground = $ToggleButton.toolbar.selectedBackground
[Gruvbox_Dark_Medium]ToggleButton.selectedBackground = $ToggleButton.selectedBackground
[Gruvbox_Dark_Medium]ToggleButton.toolbar.selectedBackground = $ToggleButton.toolbar.selectedBackground
[Gruvbox_Dark_Soft]MenuItem.checkBackground = @ijMenuCheckBackgroundL10
[Gruvbox_Dark_Soft]MenuItem.underlineSelectionCheckBackground = @ijMenuCheckBackgroundL10
[Gruvbox_Dark_Soft]ToggleButton.selectedBackground = $ToggleButton.selectedBackground
[Gruvbox_Dark_Soft]ToggleButton.toolbar.selectedBackground = $ToggleButton.toolbar.selectedBackground
@@ -88,10 +115,20 @@ ToggleButton.endBackground = $ToggleButton.background
[High_contrast]ToggleButton.disabledSelectedBackground = #444
[High_contrast]ToggleButton.toolbar.selectedBackground = #fff
[Monocai]MenuItem.checkBackground = @ijMenuCheckBackgroundL10
[Monocai]MenuItem.underlineSelectionCheckBackground = @ijMenuCheckBackgroundL10
[Nord]MenuItem.checkBackground = @ijMenuCheckBackgroundL10
[Nord]MenuItem.underlineSelectionCheckBackground = @ijMenuCheckBackgroundL10
[One_Dark]MenuItem.checkBackground = @ijMenuCheckBackgroundL10
[One_Dark]MenuItem.underlineSelectionCheckBackground = @ijMenuCheckBackgroundL10
[One_Dark]Slider.focusedColor = fade(#568af2,40%)
[Solarized_Dark]Slider.focusedColor = fade($Component.focusColor,80%,derived)
[vuesion-theme]MenuItem.checkBackground = @ijMenuCheckBackgroundL10
[vuesion-theme]MenuItem.underlineSelectionCheckBackground = @ijMenuCheckBackgroundL10
[vuesion-theme]Slider.trackValueColor = #ececee
[vuesion-theme]Slider.trackColor = #303a45
[vuesion-theme]Slider.thumbColor = #ececee
@@ -100,6 +137,11 @@ ToggleButton.endBackground = $ToggleButton.background
# Material Theme UI Lite
[light][author-Mallowigi]MenuItem.checkBackground = @ijMenuCheckBackgroundD10
[light][author-Mallowigi]MenuItem.underlineSelectionCheckBackground = @ijMenuCheckBackgroundD10
[dark][author-Mallowigi]MenuItem.checkBackground = @ijMenuCheckBackgroundL20
[dark][author-Mallowigi]MenuItem.underlineSelectionCheckBackground = @ijMenuCheckBackgroundL20
[Dracula_Contrast]ProgressBar.selectionBackground = #fff
[Dracula_Contrast]ProgressBar.selectionForeground = #fff

View File

@@ -542,7 +542,7 @@ MenuItem.arrowIcon [lazy] 6,10 com.formdev.flatlaf.icons.FlatMenu
MenuItem.background #303234 javax.swing.plaf.ColorUIResource [UI]
MenuItem.border [lazy] 0,0,0,0 false com.formdev.flatlaf.ui.FlatMenuItemBorder [UI]
MenuItem.borderPainted true
MenuItem.checkBackground #3c588b javax.swing.plaf.ColorUIResource [UI]
MenuItem.checkBackground #3c588b com.formdev.flatlaf.util.DerivedColor [UI] darken(10%)
MenuItem.checkMargins 2,2,2,2 javax.swing.plaf.InsetsUIResource [UI]
MenuItem.disabledForeground #888888 javax.swing.plaf.ColorUIResource [UI]
MenuItem.font [active] $defaultFont [UI]
@@ -557,7 +557,7 @@ MenuItem.selectionForeground #bbbbbb javax.swing.plaf.ColorUIResource [UI]
MenuItem.textAcceleratorGap 24
MenuItem.textNoAcceleratorGap 6
MenuItem.underlineSelectionBackground #484c4f com.formdev.flatlaf.util.DerivedColor [UI] lighten(10% autoInverse)
MenuItem.underlineSelectionCheckBackground #3c588b javax.swing.plaf.ColorUIResource [UI]
MenuItem.underlineSelectionCheckBackground #3c588b com.formdev.flatlaf.util.DerivedColor [UI] darken(10%)
MenuItem.underlineSelectionColor #4a88c7 javax.swing.plaf.ColorUIResource [UI]
MenuItem.underlineSelectionHeight 3

View File

@@ -548,7 +548,7 @@ MenuItem.arrowIcon [lazy] 6,10 com.formdev.flatlaf.icons.FlatMenu
MenuItem.background #ffffff javax.swing.plaf.ColorUIResource [UI]
MenuItem.border [lazy] 0,0,0,0 false com.formdev.flatlaf.ui.FlatMenuItemBorder [UI]
MenuItem.borderPainted true
MenuItem.checkBackground #bfd9f2 javax.swing.plaf.ColorUIResource [UI]
MenuItem.checkBackground #bfd9f2 com.formdev.flatlaf.util.DerivedColor [UI] lighten(40%)
MenuItem.checkMargins 2,2,2,2 javax.swing.plaf.InsetsUIResource [UI]
MenuItem.disabledForeground #8c8c8c javax.swing.plaf.ColorUIResource [UI]
MenuItem.font [active] $defaultFont [UI]
@@ -563,7 +563,7 @@ MenuItem.selectionForeground #ffffff javax.swing.plaf.ColorUIResource [UI]
MenuItem.textAcceleratorGap 24
MenuItem.textNoAcceleratorGap 6
MenuItem.underlineSelectionBackground #e6e6e6 com.formdev.flatlaf.util.DerivedColor [UI] darken(10% autoInverse)
MenuItem.underlineSelectionCheckBackground #bfd9f2 javax.swing.plaf.ColorUIResource [UI]
MenuItem.underlineSelectionCheckBackground #bfd9f2 com.formdev.flatlaf.util.DerivedColor [UI] lighten(40%)
MenuItem.underlineSelectionColor #4083c9 javax.swing.plaf.ColorUIResource [UI]
MenuItem.underlineSelectionHeight 3

View File

@@ -211,11 +211,15 @@ public class FlatMenusTest
JMenuItem menuItem3 = new JMenuItem();
JCheckBoxMenuItem checkBoxMenuItem3 = new JCheckBoxMenuItem();
JRadioButtonMenuItem radioButtonMenuItem3 = new JRadioButtonMenuItem();
JCheckBoxMenuItem checkBoxMenuItem9 = new JCheckBoxMenuItem();
JRadioButtonMenuItem radioButtonMenuItem7 = new JRadioButtonMenuItem();
JPanel panel4 = new JPanel();
JMenu menu4 = new JMenu();
JMenuItem menuItem4 = new JMenuItem();
JCheckBoxMenuItem checkBoxMenuItem4 = new JCheckBoxMenuItem();
JRadioButtonMenuItem radioButtonMenuItem4 = new JRadioButtonMenuItem();
JCheckBoxMenuItem checkBoxMenuItem10 = new JCheckBoxMenuItem();
JRadioButtonMenuItem radioButtonMenuItem11 = new JRadioButtonMenuItem();
JLabel popupMenuLabel = new JLabel();
JButton showPopupMenuButton = new JButton();
armedCheckBox = new JCheckBox();
@@ -670,6 +674,8 @@ public class FlatMenusTest
"[]" +
"[]" +
"[]" +
"[]" +
"[]" +
"[]"));
//======== menu3 ========
@@ -696,6 +702,20 @@ public class FlatMenusTest
radioButtonMenuItem3.setSelected(true);
radioButtonMenuItem3.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0));
panel3.add(radioButtonMenuItem3, "cell 0 3");
//---- checkBoxMenuItem9 ----
checkBoxMenuItem9.setText("selected");
checkBoxMenuItem9.setSelected(true);
checkBoxMenuItem9.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0));
checkBoxMenuItem9.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/intellij-showReadAccess.png")));
panel3.add(checkBoxMenuItem9, "cell 0 4");
//---- radioButtonMenuItem7 ----
radioButtonMenuItem7.setText("selected");
radioButtonMenuItem7.setSelected(true);
radioButtonMenuItem7.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0));
radioButtonMenuItem7.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/intellij-showReadAccess.png")));
panel3.add(radioButtonMenuItem7, "cell 0 5");
}
add(panel3, "cell 3 1");
@@ -710,6 +730,8 @@ public class FlatMenusTest
"[]" +
"[]" +
"[]" +
"[]" +
"[]" +
"[]"));
//======== menu4 ========
@@ -739,6 +761,22 @@ public class FlatMenusTest
radioButtonMenuItem4.setSelected(true);
radioButtonMenuItem4.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0));
panel4.add(radioButtonMenuItem4, "cell 0 3");
//---- checkBoxMenuItem10 ----
checkBoxMenuItem10.setText("selected disabled");
checkBoxMenuItem10.setEnabled(false);
checkBoxMenuItem10.setSelected(true);
checkBoxMenuItem10.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0));
checkBoxMenuItem10.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/intellij-showReadAccess.png")));
panel4.add(checkBoxMenuItem10, "cell 0 4");
//---- radioButtonMenuItem11 ----
radioButtonMenuItem11.setText("selected disabled");
radioButtonMenuItem11.setEnabled(false);
radioButtonMenuItem11.setSelected(true);
radioButtonMenuItem11.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0));
radioButtonMenuItem11.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/intellij-showReadAccess.png")));
panel4.add(radioButtonMenuItem11, "cell 0 5");
}
add(panel4, "cell 4 1");

View File

@@ -1,4 +1,4 @@
JFDML JFormDesigner: "7.0.2.0.298" Java: "15" encoding: "UTF-8"
JFDML JFormDesigner: "7.0.3.1.342" Java: "15" encoding: "UTF-8"
new FormModel {
contentType: "form/swing"
@@ -454,7 +454,7 @@ new FormModel {
} )
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
"$columnConstraints": "[fill]"
"$rowConstraints": "[][][][]"
"$rowConstraints": "[][][][][][]"
"$layoutConstraints": "insets 0"
} ) {
name: "panel3"
@@ -490,12 +490,30 @@ new FormModel {
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 3"
} )
add( new FormComponent( "javax.swing.JCheckBoxMenuItem" ) {
name: "checkBoxMenuItem9"
"text": "selected"
"selected": true
"accelerator": #KeyStroke1
"icon": &SwingIcon3 new com.jformdesigner.model.SwingIcon( 0, "/com/formdev/flatlaf/testing/disabled_icons_test/intellij-showReadAccess.png" )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 4"
} )
add( new FormComponent( "javax.swing.JRadioButtonMenuItem" ) {
name: "radioButtonMenuItem7"
"text": "selected"
"selected": true
"accelerator": #KeyStroke1
"icon": #SwingIcon3
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 5"
} )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 3 1"
} )
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
"$columnConstraints": "[fill]"
"$rowConstraints": "[][][][]"
"$rowConstraints": "[][][][][][]"
"$layoutConstraints": "insets 0"
} ) {
name: "panel4"
@@ -534,6 +552,26 @@ new FormModel {
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 3"
} )
add( new FormComponent( "javax.swing.JCheckBoxMenuItem" ) {
name: "checkBoxMenuItem10"
"text": "selected disabled"
"enabled": false
"selected": true
"accelerator": #KeyStroke1
"icon": &SwingIcon4 new com.jformdesigner.model.SwingIcon( 0, "/com/formdev/flatlaf/testing/disabled_icons_test/intellij-showReadAccess.png" )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 4"
} )
add( new FormComponent( "javax.swing.JRadioButtonMenuItem" ) {
name: "radioButtonMenuItem11"
"text": "selected disabled"
"enabled": false
"selected": true
"accelerator": #KeyStroke1
"icon": #SwingIcon4
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 5"
} )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 4 1"
} )