mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2025-12-07 14:30:56 +03:00
IntelliJ Themes: fixes for ComboBox, Spinner, CheckBox and RadioButton
This commit is contained in:
@@ -139,6 +139,10 @@ public class IntelliJTheme
|
|||||||
applyColorPalette( defaults );
|
applyColorPalette( defaults );
|
||||||
applyCheckBoxColors( defaults );
|
applyCheckBoxColors( defaults );
|
||||||
|
|
||||||
|
// IDEA uses TextField.background for editable ComboBox and Spinner
|
||||||
|
defaults.put( "ComboBox.editableBackground", defaults.get( "TextField.background" ) );
|
||||||
|
defaults.put( "Spinner.background", defaults.get( "TextField.background" ) );
|
||||||
|
|
||||||
// Spinner arrow button always has same colors as ComboBox arrow button
|
// Spinner arrow button always has same colors as ComboBox arrow button
|
||||||
defaults.put( "Spinner.buttonBackground", defaults.get( "ComboBox.buttonEditableBackground" ) );
|
defaults.put( "Spinner.buttonBackground", defaults.get( "ComboBox.buttonEditableBackground" ) );
|
||||||
defaults.put( "Spinner.buttonArrowColor", defaults.get( "ComboBox.buttonArrowColor" ) );
|
defaults.put( "Spinner.buttonArrowColor", defaults.get( "ComboBox.buttonArrowColor" ) );
|
||||||
@@ -246,7 +250,7 @@ public class IntelliJTheme
|
|||||||
// (e.g. set ComboBox.buttonEditableBackground to *.background
|
// (e.g. set ComboBox.buttonEditableBackground to *.background
|
||||||
// because it is mapped from ComboBox.ArrowButton.background)
|
// because it is mapped from ComboBox.ArrowButton.background)
|
||||||
String km = uiKeyInverseMapping.getOrDefault( k, (String) k );
|
String km = uiKeyInverseMapping.getOrDefault( k, (String) k );
|
||||||
if( km.endsWith( tail ) && !noWildcardReplace.contains( k ) )
|
if( km.endsWith( tail ) && !noWildcardReplace.contains( k ) && !((String)k).startsWith( "CheckBox.icon." ) )
|
||||||
defaults.put( k, uiValue );
|
defaults.put( k, uiValue );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -289,7 +293,7 @@ public class IntelliJTheme
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Because Darcula uses SVGs for check boxes and radio buttons the colors for
|
* Because IDEA uses SVGs for check boxes and radio buttons the colors for
|
||||||
* this two components are specified in "icons > ColorPalette".
|
* this two components are specified in "icons > ColorPalette".
|
||||||
* FlatLaf uses vector icons and expects colors for the two components in UI defaults.
|
* FlatLaf uses vector icons and expects colors for the two components in UI defaults.
|
||||||
*/
|
*/
|
||||||
@@ -310,6 +314,17 @@ public class IntelliJTheme
|
|||||||
if( !key.startsWith( "Checkbox." ) || !(value instanceof String) )
|
if( !key.startsWith( "Checkbox." ) || !(value instanceof String) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if( key.equals( "Checkbox.Background.Default" ) ||
|
||||||
|
key.equals( "Checkbox.Foreground.Selected" ) )
|
||||||
|
{
|
||||||
|
// This two keys do not work correctly in IDEA because they
|
||||||
|
// map SVG color "#ffffff" to another color, but checkBox.svg and
|
||||||
|
// radio.svg (in package com.intellij.ide.ui.laf.icons.intellij)
|
||||||
|
// use "#fff". So use white to get same appearance as in IDEA.
|
||||||
|
value = "#ffffff";
|
||||||
|
}
|
||||||
|
|
||||||
|
if( dark )
|
||||||
key = StringUtils.removeTrailing( key, ".Dark" );
|
key = StringUtils.removeTrailing( key, ".Dark" );
|
||||||
|
|
||||||
String newKey = checkboxKeyMapping.get( key );
|
String newKey = checkboxKeyMapping.get( key );
|
||||||
@@ -322,7 +337,7 @@ public class IntelliJTheme
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// When Darcula replaces colors in SVGs it uses color values and not the keys
|
// When IDEA replaces colors in SVGs it uses color values and not the keys
|
||||||
// from com.intellij.ide.ui.UITheme.colorPalette, but there are some keys that
|
// from com.intellij.ide.ui.UITheme.colorPalette, but there are some keys that
|
||||||
// have same color value:
|
// have same color value:
|
||||||
// - Checkbox.Background.Default.Dark has same color as Checkbox.Background.Selected.Dark
|
// - Checkbox.Background.Default.Dark has same color as Checkbox.Background.Selected.Dark
|
||||||
@@ -366,7 +381,7 @@ public class IntelliJTheme
|
|||||||
|
|
||||||
static {
|
static {
|
||||||
// Button
|
// Button
|
||||||
// Darcula buttons support gradient for background and border, but FlatLaf does not
|
// IDEA buttons support gradient for background and border, but FlatLaf does not
|
||||||
uiKeyMapping.put( "Button.startBackground", "Button.background" );
|
uiKeyMapping.put( "Button.startBackground", "Button.background" );
|
||||||
uiKeyMapping.put( "Button.startBorderColor", "Button.borderColor" );
|
uiKeyMapping.put( "Button.startBorderColor", "Button.borderColor" );
|
||||||
uiKeyMapping.put( "Button.default.startBackground", "Button.default.background" );
|
uiKeyMapping.put( "Button.default.startBackground", "Button.default.background" );
|
||||||
@@ -377,7 +392,7 @@ public class IntelliJTheme
|
|||||||
uiKeyMapping.put( "Button.default.endBorderColor", "" ); // ignore
|
uiKeyMapping.put( "Button.default.endBorderColor", "" ); // ignore
|
||||||
|
|
||||||
// ComboBox
|
// ComboBox
|
||||||
uiKeyMapping.put( "ComboBox.background", "ComboBox.editableBackground" );
|
uiKeyMapping.put( "ComboBox.background", "" ); // ignore
|
||||||
uiKeyMapping.put( "ComboBox.nonEditableBackground", "ComboBox.background" );
|
uiKeyMapping.put( "ComboBox.nonEditableBackground", "ComboBox.background" );
|
||||||
uiKeyMapping.put( "ComboBox.ArrowButton.background", "ComboBox.buttonEditableBackground" );
|
uiKeyMapping.put( "ComboBox.ArrowButton.background", "ComboBox.buttonEditableBackground" );
|
||||||
uiKeyMapping.put( "ComboBox.ArrowButton.disabledIconColor", "ComboBox.buttonDisabledArrowColor" );
|
uiKeyMapping.put( "ComboBox.ArrowButton.disabledIconColor", "ComboBox.buttonDisabledArrowColor" );
|
||||||
@@ -409,7 +424,7 @@ public class IntelliJTheme
|
|||||||
checkboxKeyMapping.put( "Checkbox.Focus.Thin.Selected", "CheckBox.icon.selectedFocusedBorderColor" );
|
checkboxKeyMapping.put( "Checkbox.Focus.Thin.Selected", "CheckBox.icon.selectedFocusedBorderColor" );
|
||||||
|
|
||||||
// because FlatLaf uses Button.background and Button.borderColor,
|
// because FlatLaf uses Button.background and Button.borderColor,
|
||||||
// but Darcula uses Button.startBackground and Button.startBorderColor,
|
// but IDEA uses Button.startBackground and Button.startBorderColor,
|
||||||
// our default button background and border colors may be replaced by
|
// our default button background and border colors may be replaced by
|
||||||
// wildcard *.background and *.borderColor colors
|
// wildcard *.background and *.borderColor colors
|
||||||
noWildcardReplace.add( "Button.background" );
|
noWildcardReplace.add( "Button.background" );
|
||||||
|
|||||||
Reference in New Issue
Block a user