mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-12 15:07:11 -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 ) {
|
if( uiValue == null ) {
|
||||||
// fix errors (missing '#' for colors)
|
// fix errors (missing '#' for colors)
|
||||||
if( !valueStr.startsWith( "#" ) && (key.endsWith( "ground" ) || key.endsWith( "Color" )) )
|
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" ) ) {
|
else if( key.endsWith( ".border" ) || key.endsWith( "Border" ) ) {
|
||||||
List<String> parts = StringUtils.split( valueStr, ',' );
|
List<String> parts = StringUtils.split( valueStr, ',' );
|
||||||
if( parts.size() == 5 && !parts.get( 4 ).startsWith( "#" ) ) {
|
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 ) {
|
private void applyColorPalette( UIDefaults defaults ) {
|
||||||
if( icons == null )
|
if( icons == null )
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user