diff --git a/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/intellijthemes/IJThemesManager.java b/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/intellijthemes/IJThemesManager.java index bdb4314c..75bc0784 100644 --- a/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/intellijthemes/IJThemesManager.java +++ b/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/intellijthemes/IJThemesManager.java @@ -18,12 +18,14 @@ package com.formdev.flatlaf.demo.intellijthemes; import java.io.File; import java.io.IOException; -import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.Reader; +import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Properties; +import com.formdev.flatlaf.json.Json; import com.formdev.flatlaf.util.StringUtils; /** @@ -35,23 +37,27 @@ class IJThemesManager final List moreThemes = new ArrayList<>(); private final Map lastModifiedMap = new HashMap<>(); + @SuppressWarnings( "unchecked" ) void loadBundledThemes() { - // load themes.properties - Properties properties = new Properties(); - try( InputStream in = getClass().getResourceAsStream( "themes.properties" ) ) { - if( in != null ) - properties.load( in ); + bundledThemes.clear(); + + // load themes.json + Map json; + try( Reader reader = new InputStreamReader( getClass().getResourceAsStream( "themes.json" ), StandardCharsets.UTF_8 ) ) { + json = (Map) Json.parse( reader ); } catch( IOException ex ) { ex.printStackTrace(); + return; } // add info about bundled themes - bundledThemes.clear(); - for( Map.Entry e : properties.entrySet() ) { - String resourceName = (String) e.getKey(); - List strs = StringUtils.split( (String) e.getValue(), ',' ); + for( Map.Entry e : json.entrySet() ) { + String resourceName = e.getKey(); + Map value = (Map) e.getValue(); + String name = value.get( "name" ); + String sourceCodeUrl = value.get( "sourceCodeUrl" ); - bundledThemes.add( new IJThemeInfo( strs.get( 0 ), resourceName, strs.get( 1 ), null, null ) ); + bundledThemes.add( new IJThemeInfo( name, resourceName, sourceCodeUrl, null, null ) ); } } diff --git a/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/themes.json b/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/themes.json new file mode 100644 index 00000000..ffc606dc --- /dev/null +++ b/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/themes.json @@ -0,0 +1,203 @@ +{ + "arc-theme.theme.json": { + "name": "Arc", + "sourceCodeUrl": "https://gitlab.com/zlamalp/arc-theme-idea" + }, + "arc-theme-orange.theme.json": { + "name": "Arc - Orange", + "sourceCodeUrl": "https://gitlab.com/zlamalp/arc-theme-idea" + }, + "Cyan.theme.json": { + "name": "Cyan light", + "sourceCodeUrl": "https://github.com/OlyaB/CyanTheme" + }, + "DarkFlatTheme.theme.json": { + "name": "Dark Flat", + "sourceCodeUrl": "https://github.com/nerzhulart/DarkFlatTheme" + }, + "DarkPurple.theme.json": { + "name": "Dark purple", + "sourceCodeUrl": "https://github.com/OlyaB/DarkPurpleTheme" + }, + "Dracula.theme.json": { + "name": "Dracula", + "sourceCodeUrl": "https://github.com/dracula/jetbrains" + }, + "Gray.theme.json": { + "name": "Gray", + "sourceCodeUrl": "https://github.com/OlyaB/GreyTheme" + }, + "gruvbox_theme.theme.json": { + "name": "Gruvbox", + "sourceCodeUrl": "https://github.com/Vincent-P/gruvbox-intellij-theme" + }, + "Hiberbee.theme.json": { + "name": "Hiberbee", + "sourceCodeUrl": "https://github.com/Hiberbee/code-highlight-themes" + }, + "HighContrast.theme.json": { + "name": "High contrast", + "sourceCodeUrl": "https://github.com/OlyaB/HighContrastTheme" + }, + "Light.theme.json": { + "name": "IntelliJ Light Preview", + "sourceCodeUrl": "https://github.com/OlyaB/IntelliJLightTheme" + }, + "LightFlatTheme.theme.json": { + "name": "Light Flat", + "sourceCodeUrl": "https://github.com/nerzhulart/LightFlatTheme" + }, + "MaterialTheme.theme.json": { + "name": "Material Design Dark", + "sourceCodeUrl": "https://github.com/xinkunZ/NotReallyMDTheme" + }, + "Monocai.theme.json": { + "name": "Monocai", + "sourceCodeUrl": "https://github.com/bmikaili/intellij-monocai-theme" + }, + "nord.theme.json": { + "name": "Nord", + "sourceCodeUrl": "https://github.com/arcticicestudio/nord-jetbrains" + }, + "one_dark.theme.json": { + "name": "One Dark", + "sourceCodeUrl": "https://github.com/one-dark/jetbrains-one-dark-theme" + }, + "solarized_dark_theme.theme.json": { + "name": "Solarized Dark", + "sourceCodeUrl": "https://github.com/snowe2010/solarized-jetbrains" + }, + "solarized_light_theme.theme.json": { + "name": "Solarized Light", + "sourceCodeUrl": "https://github.com/snowe2010/solarized-jetbrains" + }, + "Spacegray.theme.json": { + "name": "Spacegray", + "sourceCodeUrl": "https://github.com/mturlo/intellij-spacegray" + }, + "vuesion_theme.theme.json": { + "name": "Vuesion", + "sourceCodeUrl": "https://github.com/vuesion/intellij-theme" + }, + + "material-theme-ui-lite/Arc Dark.theme.json": { + "name": "Material Theme UI Lite / Arc Dark", + "sourceCodeUrl": "https://github.com/mallowigi/material-theme-ui-lite" + }, + "material-theme-ui-lite/Arc Dark Contrast.theme.json": { + "name": "Material Theme UI Lite / Arc Dark Contrast", + "sourceCodeUrl": "https://github.com/mallowigi/material-theme-ui-lite" + }, + "material-theme-ui-lite/Atom One Dark.theme.json": { + "name": "Material Theme UI Lite / Atom One Dark", + "sourceCodeUrl": "https://github.com/mallowigi/material-theme-ui-lite" + }, + "material-theme-ui-lite/Atom One Dark Contrast.theme.json": { + "name": "Material Theme UI Lite / Atom One Dark Contrast", + "sourceCodeUrl": "https://github.com/mallowigi/material-theme-ui-lite" + }, + "material-theme-ui-lite/Atom One Light.theme.json": { + "name": "Material Theme UI Lite / Atom One Light", + "sourceCodeUrl": "https://github.com/mallowigi/material-theme-ui-lite" + }, + "material-theme-ui-lite/Atom One Light Contrast.theme.json": { + "name": "Material Theme UI Lite / Atom One Light Contrast", + "sourceCodeUrl": "https://github.com/mallowigi/material-theme-ui-lite" + }, + "material-theme-ui-lite/Dracula.theme.json": { + "name": "Material Theme UI Lite / Dracula", + "sourceCodeUrl": "https://github.com/mallowigi/material-theme-ui-lite" + }, + "material-theme-ui-lite/Dracula Contrast.theme.json": { + "name": "Material Theme UI Lite / Dracula Contrast", + "sourceCodeUrl": "https://github.com/mallowigi/material-theme-ui-lite" + }, + "material-theme-ui-lite/GitHub.theme.json": { + "name": "Material Theme UI Lite / GitHub", + "sourceCodeUrl": "https://github.com/mallowigi/material-theme-ui-lite" + }, + "material-theme-ui-lite/GitHub Contrast.theme.json": { + "name": "Material Theme UI Lite / GitHub Contrast", + "sourceCodeUrl": "https://github.com/mallowigi/material-theme-ui-lite" + }, + "material-theme-ui-lite/Light Owl.theme.json": { + "name": "Material Theme UI Lite / Light Owl", + "sourceCodeUrl": "https://github.com/mallowigi/material-theme-ui-lite" + }, + "material-theme-ui-lite/Light Owl Contrast.theme.json": { + "name": "Material Theme UI Lite / Light Owl Contrast", + "sourceCodeUrl": "https://github.com/mallowigi/material-theme-ui-lite" + }, + "material-theme-ui-lite/Material Darker.theme.json": { + "name": "Material Theme UI Lite / Material Darker", + "sourceCodeUrl": "https://github.com/mallowigi/material-theme-ui-lite" + }, + "material-theme-ui-lite/Material Darker Contrast.theme.json": { + "name": "Material Theme UI Lite / Material Darker Contrast", + "sourceCodeUrl": "https://github.com/mallowigi/material-theme-ui-lite" + }, + "material-theme-ui-lite/Material Deep Ocean.theme.json": { + "name": "Material Theme UI Lite / Material Deep Ocean", + "sourceCodeUrl": "https://github.com/mallowigi/material-theme-ui-lite" + }, + "material-theme-ui-lite/Material Deep Ocean Contrast.theme.json": { + "name": "Material Theme UI Lite / Material Deep Ocean Contrast", + "sourceCodeUrl": "https://github.com/mallowigi/material-theme-ui-lite" + }, + "material-theme-ui-lite/Material Lighter.theme.json": { + "name": "Material Theme UI Lite / Material Lighter", + "sourceCodeUrl": "https://github.com/mallowigi/material-theme-ui-lite" + }, + "material-theme-ui-lite/Material Lighter Contrast.theme.json": { + "name": "Material Theme UI Lite / Material Lighter Contrast", + "sourceCodeUrl": "https://github.com/mallowigi/material-theme-ui-lite" + }, + "material-theme-ui-lite/Material Oceanic.theme.json": { + "name": "Material Theme UI Lite / Material Oceanic", + "sourceCodeUrl": "https://github.com/mallowigi/material-theme-ui-lite" + }, + "material-theme-ui-lite/Material Oceanic Contrast.theme.json": { + "name": "Material Theme UI Lite / Material Oceanic Contrast", + "sourceCodeUrl": "https://github.com/mallowigi/material-theme-ui-lite" + }, + "material-theme-ui-lite/Material Palenight.theme.json": { + "name": "Material Theme UI Lite / Material Palenight", + "sourceCodeUrl": "https://github.com/mallowigi/material-theme-ui-lite" + }, + "material-theme-ui-lite/Material Palenight Contrast.theme.json": { + "name": "Material Theme UI Lite / Material Palenight Contrast", + "sourceCodeUrl": "https://github.com/mallowigi/material-theme-ui-lite" + }, + "material-theme-ui-lite/Monokai Pro.theme.json": { + "name": "Material Theme UI Lite / Monokai Pro", + "sourceCodeUrl": "https://github.com/mallowigi/material-theme-ui-lite" + }, + "material-theme-ui-lite/Monokai Pro Contrast.theme.json": { + "name": "Material Theme UI Lite / Monokai Pro Contrast", + "sourceCodeUrl": "https://github.com/mallowigi/material-theme-ui-lite" + }, + "material-theme-ui-lite/Night Owl.theme.json": { + "name": "Material Theme UI Lite / Night Owl", + "sourceCodeUrl": "https://github.com/mallowigi/material-theme-ui-lite" + }, + "material-theme-ui-lite/Night Owl Contrast.theme.json": { + "name": "Material Theme UI Lite / Night Owl Contrast", + "sourceCodeUrl": "https://github.com/mallowigi/material-theme-ui-lite" + }, + "material-theme-ui-lite/Solarized Dark.theme.json": { + "name": "Material Theme UI Lite / Solarized Dark", + "sourceCodeUrl": "https://github.com/mallowigi/material-theme-ui-lite" + }, + "material-theme-ui-lite/Solarized Dark Contrast.theme.json": { + "name": "Material Theme UI Lite / Solarized Dark Contrast", + "sourceCodeUrl": "https://github.com/mallowigi/material-theme-ui-lite" + }, + "material-theme-ui-lite/Solarized Light.theme.json": { + "name": "Material Theme UI Lite / Solarized Light", + "sourceCodeUrl": "https://github.com/mallowigi/material-theme-ui-lite" + }, + "material-theme-ui-lite/Solarized Light Contrast.theme.json": { + "name": "Material Theme UI Lite / Solarized Light Contrast", + "sourceCodeUrl": "https://github.com/mallowigi/material-theme-ui-lite" + } +} diff --git a/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/themes.properties b/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/themes.properties deleted file mode 100644 index 62b86601..00000000 --- a/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/intellijthemes/themes.properties +++ /dev/null @@ -1,52 +0,0 @@ -arc-theme.theme.json=Arc,https://gitlab.com/zlamalp/arc-theme-idea -arc-theme-orange.theme.json=Arc - Orange,https://gitlab.com/zlamalp/arc-theme-idea -Cyan.theme.json=Cyan light,https://github.com/OlyaB/CyanTheme -DarkFlatTheme.theme.json=Dark Flat,https://github.com/nerzhulart/DarkFlatTheme -DarkPurple.theme.json=Dark purple,https://github.com/OlyaB/DarkPurpleTheme -Dracula.theme.json=Dracula,https://github.com/dracula/jetbrains -Gray.theme.json=Gray,https://github.com/OlyaB/GreyTheme -gruvbox_theme.theme.json=Gruvbox,https://github.com/Vincent-P/gruvbox-intellij-theme -Hiberbee.theme.json=Hiberbee,https://github.com/Hiberbee/code-highlight-themes -HighContrast.theme.json=High contrast,https://github.com/OlyaB/HighContrastTheme -Light.theme.json=IntelliJ Light Preview,https://github.com/OlyaB/IntelliJLightTheme -LightFlatTheme.theme.json=Light Flat,https://github.com/nerzhulart/LightFlatTheme -MaterialTheme.theme.json=Material Design Dark,https://github.com/xinkunZ/NotReallyMDTheme -Monocai.theme.json=Monocai,https://github.com/bmikaili/intellij-monocai-theme -nord.theme.json=Nord,https://github.com/arcticicestudio/nord-jetbrains -one_dark.theme.json=One Dark,https://github.com/one-dark/jetbrains-one-dark-theme -solarized_dark_theme.theme.json=Solarized Dark,https://github.com/snowe2010/solarized-jetbrains -solarized_light_theme.theme.json=Solarized Light,https://github.com/snowe2010/solarized-jetbrains -Spacegray.theme.json=Spacegray,https://github.com/mturlo/intellij-spacegray -vuesion_theme.theme.json=Vuesion,https://github.com/vuesion/intellij-theme - -# Material Theme UI Lite -material-theme-ui-lite/Arc\ Dark.theme.json=Material Theme UI Lite / Arc Dark,https://github.com/mallowigi/material-theme-ui-lite -material-theme-ui-lite/Arc\ Dark\ Contrast.theme.json=Material Theme UI Lite / Arc Dark Contrast,https://github.com/mallowigi/material-theme-ui-lite -material-theme-ui-lite/Atom\ One\ Dark.theme.json=Material Theme UI Lite / Atom One Dark,https://github.com/mallowigi/material-theme-ui-lite -material-theme-ui-lite/Atom\ One\ Dark\ Contrast.theme.json=Material Theme UI Lite / Atom One Dark Contrast,https://github.com/mallowigi/material-theme-ui-lite -material-theme-ui-lite/Atom\ One\ Light.theme.json=Material Theme UI Lite / Atom One Light,https://github.com/mallowigi/material-theme-ui-lite -material-theme-ui-lite/Atom\ One\ Light\ Contrast.theme.json=Material Theme UI Lite / Atom One Light Contrast,https://github.com/mallowigi/material-theme-ui-lite -material-theme-ui-lite/Dracula.theme.json=Material Theme UI Lite / Dracula,https://github.com/mallowigi/material-theme-ui-lite -material-theme-ui-lite/Dracula\ Contrast.theme.json=Material Theme UI Lite / Dracula Contrast,https://github.com/mallowigi/material-theme-ui-lite -material-theme-ui-lite/GitHub.theme.json=Material Theme UI Lite / GitHub,https://github.com/mallowigi/material-theme-ui-lite -material-theme-ui-lite/GitHub\ Contrast.theme.json=Material Theme UI Lite / GitHub Contrast,https://github.com/mallowigi/material-theme-ui-lite -material-theme-ui-lite/Light\ Owl.theme.json=Material Theme UI Lite / Light Owl,https://github.com/mallowigi/material-theme-ui-lite -material-theme-ui-lite/Light\ Owl\ Contrast.theme.json=Material Theme UI Lite / Light Owl Contrast,https://github.com/mallowigi/material-theme-ui-lite -material-theme-ui-lite/Material\ Darker.theme.json=Material Theme UI Lite / Material Darker,https://github.com/mallowigi/material-theme-ui-lite -material-theme-ui-lite/Material\ Darker\ Contrast.theme.json=Material Theme UI Lite / Material Darker Contrast,https://github.com/mallowigi/material-theme-ui-lite -material-theme-ui-lite/Material\ Deep\ Ocean.theme.json=Material Theme UI Lite / Material Deep Ocean,https://github.com/mallowigi/material-theme-ui-lite -material-theme-ui-lite/Material\ Deep\ Ocean\ Contrast.theme.json=Material Theme UI Lite / Material Deep Ocean Contrast,https://github.com/mallowigi/material-theme-ui-lite -material-theme-ui-lite/Material\ Lighter.theme.json=Material Theme UI Lite / Material Lighter,https://github.com/mallowigi/material-theme-ui-lite -material-theme-ui-lite/Material\ Lighter\ Contrast.theme.json=Material Theme UI Lite / Material Lighter Contrast,https://github.com/mallowigi/material-theme-ui-lite -material-theme-ui-lite/Material\ Oceanic.theme.json=Material Theme UI Lite / Material Oceanic,https://github.com/mallowigi/material-theme-ui-lite -material-theme-ui-lite/Material\ Oceanic\ Contrast.theme.json=Material Theme UI Lite / Material Oceanic Contrast,https://github.com/mallowigi/material-theme-ui-lite -material-theme-ui-lite/Material\ Palenight.theme.json=Material Theme UI Lite / Material Palenight,https://github.com/mallowigi/material-theme-ui-lite -material-theme-ui-lite/Material\ Palenight\ Contrast.theme.json=Material Theme UI Lite / Material Palenight Contrast,https://github.com/mallowigi/material-theme-ui-lite -material-theme-ui-lite/Monokai\ Pro.theme.json=Material Theme UI Lite / Monokai Pro,https://github.com/mallowigi/material-theme-ui-lite -material-theme-ui-lite/Monokai\ Pro\ Contrast.theme.json=Material Theme UI Lite / Monokai Pro Contrast,https://github.com/mallowigi/material-theme-ui-lite -material-theme-ui-lite/Night\ Owl.theme.json=Material Theme UI Lite / Night Owl,https://github.com/mallowigi/material-theme-ui-lite -material-theme-ui-lite/Night\ Owl\ Contrast.theme.json=Material Theme UI Lite / Night Owl Contrast,https://github.com/mallowigi/material-theme-ui-lite -material-theme-ui-lite/Solarized\ Dark.theme.json=Material Theme UI Lite / Solarized Dark,https://github.com/mallowigi/material-theme-ui-lite -material-theme-ui-lite/Solarized\ Dark\ Contrast.theme.json=Material Theme UI Lite / Solarized Dark Contrast,https://github.com/mallowigi/material-theme-ui-lite -material-theme-ui-lite/Solarized\ Light.theme.json=Material Theme UI Lite / Solarized Light,https://github.com/mallowigi/material-theme-ui-lite -material-theme-ui-lite/Solarized\ Light\ Contrast.theme.json=Material Theme UI Lite / Solarized Light Contrast,https://github.com/mallowigi/material-theme-ui-lite