diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/IntelliJTheme.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/IntelliJTheme.java index 86c443b5..cbb4d7fc 100644 --- a/flatlaf-core/src/main/java/com/formdev/flatlaf/IntelliJTheme.java +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/IntelliJTheme.java @@ -241,9 +241,10 @@ public class IntelliJTheme // remove theme specific UI defaults and remember only those for current theme Map themeSpecificDefaults = new HashMap<>(); String currentThemePrefix = '[' + name.replace( ' ', '_' ) + ']'; + String currentThemeAndAuthorPrefix = '[' + name.replace( ' ', '_' ) + "---" + author.replace( ' ', '_' ) + ']'; String currentAuthorPrefix = "[author-" + author.replace( ' ', '_' ) + ']'; String allThemesPrefix = "[*]"; - String[] prefixes = { currentThemePrefix, currentAuthorPrefix, allThemesPrefix }; + String[] prefixes = { currentThemePrefix, currentThemeAndAuthorPrefix, currentAuthorPrefix, allThemesPrefix }; for( String key : themeSpecificKeys ) { Object value = defaults.remove( key ); for( String prefix : prefixes ) { diff --git a/flatlaf-core/src/main/resources/com/formdev/flatlaf/IntelliJTheme$ThemeLaf.properties b/flatlaf-core/src/main/resources/com/formdev/flatlaf/IntelliJTheme$ThemeLaf.properties index d3082470..89657002 100644 --- a/flatlaf-core/src/main/resources/com/formdev/flatlaf/IntelliJTheme$ThemeLaf.properties +++ b/flatlaf-core/src/main/resources/com/formdev/flatlaf/IntelliJTheme$ThemeLaf.properties @@ -133,8 +133,8 @@ ToggleButton.endBackground = $ToggleButton.background [Dark_purple]Slider.focusedColor = fade($Component.focusColor,70%,derived) -[Dracula]ProgressBar.selectionBackground = #fff -[Dracula]ProgressBar.selectionForeground = #fff +[Dracula---Zihan_Ma]ProgressBar.selectionBackground = #fff +[Dracula---Zihan_Ma]ProgressBar.selectionForeground = #fff [Gradianto_Dark_Fuchsia]MenuItem.checkBackground = @ijMenuCheckBackgroundL10 [Gradianto_Dark_Fuchsia]MenuItem.underlineSelectionCheckBackground = @ijMenuCheckBackgroundL10 @@ -181,7 +181,7 @@ ToggleButton.endBackground = $ToggleButton.background [One_Dark]MenuItem.underlineSelectionCheckBackground = @ijMenuCheckBackgroundL10 [One_Dark]Slider.focusedColor = fade(#568af2,40%) -[Solarized_Dark]Slider.focusedColor = fade($Component.focusColor,80%,derived) +[Solarized_Dark---4lex4]Slider.focusedColor = fade($Component.focusColor,80%,derived) [vuesion-theme]MenuItem.checkBackground = @ijMenuCheckBackgroundL10 [vuesion-theme]MenuItem.underlineSelectionCheckBackground = @ijMenuCheckBackgroundL10 @@ -198,6 +198,9 @@ ToggleButton.endBackground = $ToggleButton.background [dark][author-Mallowigi]MenuItem.checkBackground = @ijMenuCheckBackgroundL20 [dark][author-Mallowigi]MenuItem.underlineSelectionCheckBackground = @ijMenuCheckBackgroundL20 +[Dracula---Mallowigi]ProgressBar.selectionBackground = #fff +[Dracula---Mallowigi]ProgressBar.selectionForeground = #fff + [Dracula_Contrast]ProgressBar.selectionBackground = #fff [Dracula_Contrast]ProgressBar.selectionForeground = #fff @@ -237,14 +240,14 @@ ToggleButton.endBackground = $ToggleButton.background [Night_Owl_Contrast]ProgressBar.selectionBackground = #ddd [Night_Owl_Contrast]ProgressBar.selectionForeground = #ddd -[Solarized_Dark]ProgressBar.selectionBackground = #ccc -[Solarized_Dark]ProgressBar.selectionForeground = #ccc +[Solarized_Dark---Mallowigi]ProgressBar.selectionBackground = #ccc +[Solarized_Dark---Mallowigi]ProgressBar.selectionForeground = #ccc -[Material_Solarized_Dark_Contrast]ProgressBar.selectionBackground = #ccc -[Material_Solarized_Dark_Contrast]ProgressBar.selectionForeground = #ccc +[Solarized_Dark_Contrast]ProgressBar.selectionBackground = #ccc +[Solarized_Dark_Contrast]ProgressBar.selectionForeground = #ccc -[Solarized_Light]ProgressBar.selectionBackground = #222 -[Solarized_Light]ProgressBar.selectionForeground = #fff +[Solarized_Light---Mallowigi]ProgressBar.selectionBackground = #222 +[Solarized_Light---Mallowigi]ProgressBar.selectionForeground = #fff -[Material_Solarized_Light_Contrast]ProgressBar.selectionBackground = #222 -[Material_Solarized_Light_Contrast]ProgressBar.selectionForeground = #fff +[Solarized_Light_Contrast]ProgressBar.selectionBackground = #222 +[Solarized_Light_Contrast]ProgressBar.selectionForeground = #fff diff --git a/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/intellijthemes/IJThemesDuplicateNameChecker.java b/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/intellijthemes/IJThemesDuplicateNameChecker.java new file mode 100644 index 00000000..3b17d097 --- /dev/null +++ b/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/intellijthemes/IJThemesDuplicateNameChecker.java @@ -0,0 +1,72 @@ +/* + * Copyright 2021 FormDev Software GmbH + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.formdev.flatlaf.demo.intellijthemes; + +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.Reader; +import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Map; +import com.formdev.flatlaf.json.Json; +import com.formdev.flatlaf.json.ParseException; + +/** + * This tool checks whether there are duplicate name fields in all theme .json files. + * + * This is important for following file, where the name is used for theme specific UI defaults: + * flatlaf-core/src/main/resources/com/formdev/flatlaf/IntelliJTheme$ThemeLaf.properties + * + * @author Karl Tauber + */ +public class IJThemesDuplicateNameChecker +{ + public static void main( String[] args ) { + IJThemesManager themesManager = new IJThemesManager(); + themesManager.loadBundledThemes(); + + HashSet names = new HashSet<>(); + for( IJThemeInfo ti : themesManager.bundledThemes ) { + if( ti.sourceCodeUrl == null || ti.sourceCodePath == null ) + continue; + + String jsonPath = "../flatlaf-intellij-themes/src/main/resources" + IJThemesPanel.THEMES_PACKAGE + ti.resourceName; + String name; + try { + name = readNameFromJson( jsonPath ); + } catch( IOException ex ) { + System.err.println( "Failed to read '" + jsonPath + "'" ); + continue; + } + + if( names.contains( name ) ) + System.out.println( "Duplicate name '" + name + "'" ); + names.add( name ); + } + } + + private static String readNameFromJson( String jsonPath ) throws IOException { + try( Reader reader = new InputStreamReader( new FileInputStream( jsonPath ), StandardCharsets.UTF_8 ) ) { + @SuppressWarnings( "unchecked" ) + Map json = (Map) Json.parse( reader ); + return (String) json.get( "name" ); + } catch( ParseException ex ) { + throw new IOException( ex.getMessage(), ex ); + } + } +}