IntelliJ Themes Demo: IJThemesUpdater tool added to update themes from source code repositories

This commit is contained in:
Karl Tauber
2019-11-26 13:31:44 +01:00
parent f3b1f4b608
commit 8edcca9745
5 changed files with 179 additions and 57 deletions

View File

@@ -26,13 +26,17 @@ class IJThemeInfo
final String name;
final String resourceName;
final String sourceCodeUrl;
final String sourceCodePath;
final File themeFile;
final String lafClassName;
IJThemeInfo( String name, String resourceName, String sourceCodeUrl, File themeFile, String lafClassName ) {
IJThemeInfo( String name, String resourceName, String sourceCodeUrl, String sourceCodePath,
File themeFile, String lafClassName )
{
this.name = name;
this.resourceName = resourceName;
this.sourceCodeUrl = sourceCodeUrl;
this.sourceCodePath = sourceCodePath;
this.themeFile = themeFile;
this.lafClassName = lafClassName;
}

View File

@@ -56,8 +56,9 @@ class IJThemesManager
Map<String, String> value = (Map<String, String>) e.getValue();
String name = value.get( "name" );
String sourceCodeUrl = value.get( "sourceCodeUrl" );
String sourceCodePath = value.get( "sourceCodePath" );
bundledThemes.add( new IJThemeInfo( name, resourceName, sourceCodeUrl, null, null ) );
bundledThemes.add( new IJThemeInfo( name, resourceName, sourceCodeUrl, sourceCodePath, null, null ) );
}
}
@@ -75,7 +76,7 @@ class IJThemesManager
moreThemes.clear();
for( File f : themeFiles ) {
String name = StringUtils.removeTrailing( f.getName(), ".theme.json" );
moreThemes.add( new IJThemeInfo( name, null, null, f, null ) );
moreThemes.add( new IJThemeInfo( name, null, null, null, f, null ) );
lastModifiedMap.put( f, f.lastModified() );
}
}

View File

@@ -99,10 +99,10 @@ public class IJThemesPanel
// add core themes at beginning
categories.put( themes.size(), "Core Themes" );
themes.add( new IJThemeInfo( "Flat Light", null, null, null, FlatLightLaf.class.getName() ) );
themes.add( new IJThemeInfo( "Flat Dark", null, null, null, FlatDarkLaf.class.getName() ) );
themes.add( new IJThemeInfo( "Flat IntelliJ", null, null, null, FlatIntelliJLaf.class.getName() ) );
themes.add( new IJThemeInfo( "Flat Darcula", null, null, null, FlatDarculaLaf.class.getName() ) );
themes.add( new IJThemeInfo( "Flat Light", null, null, null, null, FlatLightLaf.class.getName() ) );
themes.add( new IJThemeInfo( "Flat Dark", null, null, null, null, FlatDarkLaf.class.getName() ) );
themes.add( new IJThemeInfo( "Flat IntelliJ", null, null, null, null, FlatIntelliJLaf.class.getName() ) );
themes.add( new IJThemeInfo( "Flat Darcula", null, null, null, null, FlatDarculaLaf.class.getName() ) );
// add uncategorized bundled themes
categories.put( themes.size(), "IntelliJ Themes" );

View File

@@ -0,0 +1,67 @@
/*
* Copyright 2019 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
*
* http://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.File;
import java.io.IOException;
import java.net.URL;
import java.net.URLConnection;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardCopyOption;
/**
* This tool updates all IntelliJ themes listed in themes.json by downloading
* them from the source code repositories.
*
* @author Karl Tauber
*/
public class IJThemesUpdater
{
public static void main( String[] args ) {
IJThemesManager themesManager = new IJThemesManager();
themesManager.loadBundledThemes();
for( IJThemeInfo ti : themesManager.bundledThemes ) {
if( ti.sourceCodeUrl == null || ti.sourceCodePath == null )
continue;
String fromUrl = ti.sourceCodeUrl + "/" + ti.sourceCodePath;
if( fromUrl.contains( "github.com" ) )
fromUrl += "?raw=true";
else if( fromUrl.contains( "gitlab.com" ) )
fromUrl = fromUrl.replace( "/blob/", "/raw/" );
String toPath = "src/main/resources/com/formdev/flatlaf/demo/intellijthemes/" + ti.resourceName;
download( fromUrl, toPath );
}
}
private static void download( String fromUrl, String toPath ) {
System.out.println( "Download " + fromUrl );
Path out = new File( toPath ).toPath();
try {
URL url = new URL( fromUrl.replace( " ", "%20" ) );
URLConnection con = url.openConnection();
Files.copy( con.getInputStream(), out, StandardCopyOption.REPLACE_EXISTING );
} catch( IOException ex ) {
ex.printStackTrace();
}
}
}

View File

@@ -1,203 +1,253 @@
{
"arc-theme.theme.json": {
"name": "Arc",
"sourceCodeUrl": "https://gitlab.com/zlamalp/arc-theme-idea"
"sourceCodeUrl": "https://gitlab.com/zlamalp/arc-theme-idea",
"sourceCodePath": "blob/master/resources/arc-theme.theme.json"
},
"arc-theme-orange.theme.json": {
"name": "Arc - Orange",
"sourceCodeUrl": "https://gitlab.com/zlamalp/arc-theme-idea"
"sourceCodeUrl": "https://gitlab.com/zlamalp/arc-theme-idea",
"sourceCodePath": "blob/master/resources/arc-theme-orange.theme.json"
},
"Cyan.theme.json": {
"name": "Cyan light",
"sourceCodeUrl": "https://github.com/OlyaB/CyanTheme"
"sourceCodeUrl": "https://github.com/OlyaB/CyanTheme",
"sourceCodePath": "blob/master/src/Cyan.theme.json"
},
"DarkFlatTheme.theme.json": {
"name": "Dark Flat",
"sourceCodeUrl": "https://github.com/nerzhulart/DarkFlatTheme"
"sourceCodeUrl": "https://github.com/nerzhulart/DarkFlatTheme",
"sourceCodePath": "blob/master/src/DarkFlatTheme.theme.json"
},
"DarkPurple.theme.json": {
"name": "Dark purple",
"sourceCodeUrl": "https://github.com/OlyaB/DarkPurpleTheme"
"sourceCodeUrl": "https://github.com/OlyaB/DarkPurpleTheme",
"sourceCodePath": "blob/master/src/DarkPurple.theme.json"
},
"Dracula.theme.json": {
"name": "Dracula",
"sourceCodeUrl": "https://github.com/dracula/jetbrains"
"sourceCodeUrl": "https://github.com/dracula/jetbrains",
"sourceCodePath": "blob/master/src/main/resources/themes/Dracula.theme.json"
},
"Gray.theme.json": {
"name": "Gray",
"sourceCodeUrl": "https://github.com/OlyaB/GreyTheme"
"sourceCodeUrl": "https://github.com/OlyaB/GreyTheme",
"sourceCodePath": "blob/master/src/Gray.theme.json"
},
"gruvbox_theme.theme.json": {
"name": "Gruvbox",
"sourceCodeUrl": "https://github.com/Vincent-P/gruvbox-intellij-theme"
"sourceCodeUrl": "https://github.com/Vincent-P/gruvbox-intellij-theme",
"sourceCodePath": "blob/master/src/main/resources/gruvbox_theme.theme.json"
},
"Hiberbee.theme.json": {
"name": "Hiberbee",
"sourceCodeUrl": "https://github.com/Hiberbee/code-highlight-themes"
"sourceCodeUrl": "https://github.com/Hiberbee/code-highlight-themes",
"sourceCodePath": "blob/master/src/main/resources/Hiberbee.theme.json"
},
"HighContrast.theme.json": {
"name": "High contrast",
"sourceCodeUrl": "https://github.com/OlyaB/HighContrastTheme"
"sourceCodeUrl": "https://github.com/OlyaB/HighContrastTheme",
"sourceCodePath": "blob/master/src/HighContrast.theme.json"
},
"Light.theme.json": {
"name": "IntelliJ Light Preview",
"sourceCodeUrl": "https://github.com/OlyaB/IntelliJLightTheme"
"sourceCodeUrl": "https://github.com/OlyaB/IntelliJLightTheme",
"sourceCodePath": "blob/master/src/Light.theme.json"
},
"LightFlatTheme.theme.json": {
"name": "Light Flat",
"sourceCodeUrl": "https://github.com/nerzhulart/LightFlatTheme"
"sourceCodeUrl": "https://github.com/nerzhulart/LightFlatTheme",
"sourceCodePath": "blob/master/src/LightFlatTheme.theme.json"
},
"MaterialTheme.theme.json": {
"name": "Material Design Dark",
"sourceCodeUrl": "https://github.com/xinkunZ/NotReallyMDTheme"
"sourceCodeUrl": "https://github.com/xinkunZ/NotReallyMDTheme",
"sourceCodePath": "blob/master/src/main/resources/MaterialTheme.theme.json"
},
"Monocai.theme.json": {
"name": "Monocai",
"sourceCodeUrl": "https://github.com/bmikaili/intellij-monocai-theme"
"sourceCodeUrl": "https://github.com/bmikaili/intellij-monocai-theme",
"sourceCodePath": "blob/master/resources/Monocai.theme.json"
},
"nord.theme.json": {
"name": "Nord",
"sourceCodeUrl": "https://github.com/arcticicestudio/nord-jetbrains"
"sourceCodeUrl": "https://github.com/arcticicestudio/nord-jetbrains",
"sourceCodePath": "blob/develop/src/nord.theme.json"
},
"one_dark.theme.json": {
"name": "One Dark",
"sourceCodeUrl": "https://github.com/one-dark/jetbrains-one-dark-theme"
"sourceCodeUrl": "https://github.com/one-dark/jetbrains-one-dark-theme",
"sourceCodePath": "blob/master/src/main/resources/themes/one_dark.theme.json"
},
"solarized_dark_theme.theme.json": {
"name": "Solarized Dark",
"sourceCodeUrl": "https://github.com/snowe2010/solarized-jetbrains"
"sourceCodeUrl": "https://github.com/snowe2010/solarized-jetbrains",
"sourceCodePath": "blob/master/src/solarized_dark_theme.theme.json"
},
"solarized_light_theme.theme.json": {
"name": "Solarized Light",
"sourceCodeUrl": "https://github.com/snowe2010/solarized-jetbrains"
"sourceCodeUrl": "https://github.com/snowe2010/solarized-jetbrains",
"sourceCodePath": "blob/master/src/solarized_light_theme.theme.json"
},
"Spacegray.theme.json": {
"name": "Spacegray",
"sourceCodeUrl": "https://github.com/mturlo/intellij-spacegray"
"sourceCodeUrl": "https://github.com/mturlo/intellij-spacegray",
"sourceCodePath": "blob/master/src/Spacegray.theme.json"
},
"vuesion_theme.theme.json": {
"name": "Vuesion",
"sourceCodeUrl": "https://github.com/vuesion/intellij-theme"
"sourceCodeUrl": "https://github.com/vuesion/intellij-theme",
"sourceCodePath": "blob/master/resources/META-INF/vuesion_theme.theme.json"
},
"material-theme-ui-lite/Arc Dark.theme.json": {
"name": "Material Theme UI Lite / Arc Dark",
"sourceCodeUrl": "https://github.com/mallowigi/material-theme-ui-lite"
"sourceCodeUrl": "https://github.com/mallowigi/material-theme-ui-lite",
"sourceCodePath": "blob/master/src/main/resources/themes/Arc Dark.theme.json"
},
"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"
"sourceCodeUrl": "https://github.com/mallowigi/material-theme-ui-lite",
"sourceCodePath": "blob/master/src/main/resources/themes/Arc Dark Contrast.theme.json"
},
"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"
"sourceCodeUrl": "https://github.com/mallowigi/material-theme-ui-lite",
"sourceCodePath": "blob/master/src/main/resources/themes/Atom One Dark.theme.json"
},
"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"
"sourceCodeUrl": "https://github.com/mallowigi/material-theme-ui-lite",
"sourceCodePath": "blob/master/src/main/resources/themes/Atom One Dark Contrast.theme.json"
},
"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"
"sourceCodeUrl": "https://github.com/mallowigi/material-theme-ui-lite",
"sourceCodePath": "blob/master/src/main/resources/themes/Atom One Light.theme.json"
},
"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"
"sourceCodeUrl": "https://github.com/mallowigi/material-theme-ui-lite",
"sourceCodePath": "blob/master/src/main/resources/themes/Atom One Light Contrast.theme.json"
},
"material-theme-ui-lite/Dracula.theme.json": {
"name": "Material Theme UI Lite / Dracula",
"sourceCodeUrl": "https://github.com/mallowigi/material-theme-ui-lite"
"sourceCodeUrl": "https://github.com/mallowigi/material-theme-ui-lite",
"sourceCodePath": "blob/master/src/main/resources/themes/Dracula.theme.json"
},
"material-theme-ui-lite/Dracula Contrast.theme.json": {
"name": "Material Theme UI Lite / Dracula Contrast",
"sourceCodeUrl": "https://github.com/mallowigi/material-theme-ui-lite"
"sourceCodeUrl": "https://github.com/mallowigi/material-theme-ui-lite",
"sourceCodePath": "blob/master/src/main/resources/themes/Dracula Contrast.theme.json"
},
"material-theme-ui-lite/GitHub.theme.json": {
"name": "Material Theme UI Lite / GitHub",
"sourceCodeUrl": "https://github.com/mallowigi/material-theme-ui-lite"
"sourceCodeUrl": "https://github.com/mallowigi/material-theme-ui-lite",
"sourceCodePath": "blob/master/src/main/resources/themes/GitHub.theme.json"
},
"material-theme-ui-lite/GitHub Contrast.theme.json": {
"name": "Material Theme UI Lite / GitHub Contrast",
"sourceCodeUrl": "https://github.com/mallowigi/material-theme-ui-lite"
"sourceCodeUrl": "https://github.com/mallowigi/material-theme-ui-lite",
"sourceCodePath": "blob/master/src/main/resources/themes/GitHub Contrast.theme.json"
},
"material-theme-ui-lite/Light Owl.theme.json": {
"name": "Material Theme UI Lite / Light Owl",
"sourceCodeUrl": "https://github.com/mallowigi/material-theme-ui-lite"
"sourceCodeUrl": "https://github.com/mallowigi/material-theme-ui-lite",
"sourceCodePath": "blob/master/src/main/resources/themes/Light Owl.theme.json"
},
"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"
"sourceCodeUrl": "https://github.com/mallowigi/material-theme-ui-lite",
"sourceCodePath": "blob/master/src/main/resources/themes/Light Owl Contrast.theme.json"
},
"material-theme-ui-lite/Material Darker.theme.json": {
"name": "Material Theme UI Lite / Material Darker",
"sourceCodeUrl": "https://github.com/mallowigi/material-theme-ui-lite"
"sourceCodeUrl": "https://github.com/mallowigi/material-theme-ui-lite",
"sourceCodePath": "blob/master/src/main/resources/themes/Material Darker.theme.json"
},
"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"
"sourceCodeUrl": "https://github.com/mallowigi/material-theme-ui-lite",
"sourceCodePath": "blob/master/src/main/resources/themes/Material Darker Contrast.theme.json"
},
"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"
"sourceCodeUrl": "https://github.com/mallowigi/material-theme-ui-lite",
"sourceCodePath": "blob/master/src/main/resources/themes/Material Deep Ocean.theme.json"
},
"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"
"sourceCodeUrl": "https://github.com/mallowigi/material-theme-ui-lite",
"sourceCodePath": "blob/master/src/main/resources/themes/Material Deep Ocean Contrast.theme.json"
},
"material-theme-ui-lite/Material Lighter.theme.json": {
"name": "Material Theme UI Lite / Material Lighter",
"sourceCodeUrl": "https://github.com/mallowigi/material-theme-ui-lite"
"sourceCodeUrl": "https://github.com/mallowigi/material-theme-ui-lite",
"sourceCodePath": "blob/master/src/main/resources/themes/Material Lighter.theme.json"
},
"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"
"sourceCodeUrl": "https://github.com/mallowigi/material-theme-ui-lite",
"sourceCodePath": "blob/master/src/main/resources/themes/Material Lighter Contrast.theme.json"
},
"material-theme-ui-lite/Material Oceanic.theme.json": {
"name": "Material Theme UI Lite / Material Oceanic",
"sourceCodeUrl": "https://github.com/mallowigi/material-theme-ui-lite"
"sourceCodeUrl": "https://github.com/mallowigi/material-theme-ui-lite",
"sourceCodePath": "blob/master/src/main/resources/themes/Material Oceanic.theme.json"
},
"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"
"sourceCodeUrl": "https://github.com/mallowigi/material-theme-ui-lite",
"sourceCodePath": "blob/master/src/main/resources/themes/Material Oceanic Contrast.theme.json"
},
"material-theme-ui-lite/Material Palenight.theme.json": {
"name": "Material Theme UI Lite / Material Palenight",
"sourceCodeUrl": "https://github.com/mallowigi/material-theme-ui-lite"
"sourceCodeUrl": "https://github.com/mallowigi/material-theme-ui-lite",
"sourceCodePath": "blob/master/src/main/resources/themes/Material Palenight.theme.json"
},
"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"
"sourceCodeUrl": "https://github.com/mallowigi/material-theme-ui-lite",
"sourceCodePath": "blob/master/src/main/resources/themes/Material Palenight Contrast.theme.json"
},
"material-theme-ui-lite/Monokai Pro.theme.json": {
"name": "Material Theme UI Lite / Monokai Pro",
"sourceCodeUrl": "https://github.com/mallowigi/material-theme-ui-lite"
"sourceCodeUrl": "https://github.com/mallowigi/material-theme-ui-lite",
"sourceCodePath": "blob/master/src/main/resources/themes/Monokai Pro.theme.json"
},
"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"
"sourceCodeUrl": "https://github.com/mallowigi/material-theme-ui-lite",
"sourceCodePath": "blob/master/src/main/resources/themes/Monokai Pro Contrast.theme.json"
},
"material-theme-ui-lite/Night Owl.theme.json": {
"name": "Material Theme UI Lite / Night Owl",
"sourceCodeUrl": "https://github.com/mallowigi/material-theme-ui-lite"
"sourceCodeUrl": "https://github.com/mallowigi/material-theme-ui-lite",
"sourceCodePath": "blob/master/src/main/resources/themes/Night Owl.theme.json"
},
"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"
"sourceCodeUrl": "https://github.com/mallowigi/material-theme-ui-lite",
"sourceCodePath": "blob/master/src/main/resources/themes/Night Owl Contrast.theme.json"
},
"material-theme-ui-lite/Solarized Dark.theme.json": {
"name": "Material Theme UI Lite / Solarized Dark",
"sourceCodeUrl": "https://github.com/mallowigi/material-theme-ui-lite"
"sourceCodeUrl": "https://github.com/mallowigi/material-theme-ui-lite",
"sourceCodePath": "blob/master/src/main/resources/themes/Solarized Dark.theme.json"
},
"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"
"sourceCodeUrl": "https://github.com/mallowigi/material-theme-ui-lite",
"sourceCodePath": "blob/master/src/main/resources/themes/Solarized Dark Contrast.theme.json"
},
"material-theme-ui-lite/Solarized Light.theme.json": {
"name": "Material Theme UI Lite / Solarized Light",
"sourceCodeUrl": "https://github.com/mallowigi/material-theme-ui-lite"
"sourceCodeUrl": "https://github.com/mallowigi/material-theme-ui-lite",
"sourceCodePath": "blob/master/src/main/resources/themes/Solarized Light.theme.json"
},
"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"
"sourceCodeUrl": "https://github.com/mallowigi/material-theme-ui-lite",
"sourceCodePath": "blob/master/src/main/resources/themes/Solarized Light Contrast.theme.json"
}
}