mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-11 06:27:13 -06:00
IntelliJ Themes:
- accept colors starting with two `#` as valid colors because IntelliJ IDEA does it too - fixed wrong error message when a color reference is missing (issue #26)
This commit is contained in:
@@ -230,7 +230,9 @@ public class IntelliJTheme
|
||||
if( uiValue == null ) {
|
||||
// fix errors (missing '#' for colors)
|
||||
if( !valueStr.startsWith( "#" ) && (key.endsWith( "ground" ) || key.endsWith( "Color" )) )
|
||||
valueStr = "#" + valueStr;
|
||||
valueStr = fixColorIfValid( "#" + valueStr, valueStr );
|
||||
else if( valueStr.startsWith( "##" ) )
|
||||
valueStr = fixColorIfValid( valueStr.substring( 1 ), valueStr );
|
||||
else if( key.endsWith( ".border" ) || key.endsWith( "Border" ) ) {
|
||||
List<String> parts = StringUtils.split( valueStr, ',' );
|
||||
if( parts.size() == 5 && !parts.get( 4 ).startsWith( "#" ) ) {
|
||||
@@ -277,6 +279,17 @@ public class IntelliJTheme
|
||||
}
|
||||
}
|
||||
|
||||
private String fixColorIfValid( String newColorStr, String colorStr ) {
|
||||
try {
|
||||
// check whether it is valid
|
||||
UIDefaultsLoader.parseColorRGBA( newColorStr );
|
||||
|
||||
return newColorStr;
|
||||
} catch( IllegalArgumentException ex ) {
|
||||
return colorStr;
|
||||
}
|
||||
}
|
||||
|
||||
private void applyColorPalette( UIDefaults defaults ) {
|
||||
if( icons == null )
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user