IntelliJ Themes: minor fixes to text in progress bars for some themes

This commit is contained in:
Karl Tauber
2021-04-11 18:59:23 +02:00
parent 1f591f3d1b
commit 0d86d39217
3 changed files with 88 additions and 12 deletions

View File

@@ -241,9 +241,10 @@ 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 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 ) {

View File

@@ -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

View File

@@ -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<String> 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<String, Object> json = (Map<String, Object>) Json.parse( reader );
return (String) json.get( "name" );
} catch( ParseException ex ) {
throw new IOException( ex.getMessage(), ex );
}
}
}