Browse Source

Moved themes to own module.

Decoupled loading of ui properties from theme properties.
pull/127/head
weisj 5 years ago
parent
commit
f866e503a7
  1. 1
      core/build.gradle.kts
  2. 5
      core/src/main/java/com/github/weisj/darklaf/task/FontDefaultsInitTask.java
  3. 13
      core/src/main/java/com/github/weisj/darklaf/task/PropertyFontMapper.java
  4. 63
      core/src/main/java/com/github/weisj/darklaf/task/ThemeDefaultsInitTask.java
  5. 12
      core/src/test/java/theme/MyCustomTheme.java
  6. 1
      settings.gradle.kts
  7. 7
      theme/build.gradle.kts
  8. 0
      theme/src/main/java/com/github/weisj/darklaf/theme/ColorToneRule.java
  9. 0
      theme/src/main/java/com/github/weisj/darklaf/theme/ContrastRule.java
  10. 0
      theme/src/main/java/com/github/weisj/darklaf/theme/DarculaTheme.java
  11. 0
      theme/src/main/java/com/github/weisj/darklaf/theme/DefaultThemeProvider.java
  12. 0
      theme/src/main/java/com/github/weisj/darklaf/theme/FontMapper.java
  13. 6
      theme/src/main/java/com/github/weisj/darklaf/theme/FontSizeRule.java
  14. 8
      theme/src/main/java/com/github/weisj/darklaf/theme/HighContrastDarkTheme.java
  15. 8
      theme/src/main/java/com/github/weisj/darklaf/theme/HighContrastLightTheme.java
  16. 4
      theme/src/main/java/com/github/weisj/darklaf/theme/IntelliJTheme.java
  17. 0
      theme/src/main/java/com/github/weisj/darklaf/theme/PreferredThemeStyle.java
  18. 0
      theme/src/main/java/com/github/weisj/darklaf/theme/PresetIconRule.java
  19. 4
      theme/src/main/java/com/github/weisj/darklaf/theme/SolarizedDarkTheme.java
  20. 4
      theme/src/main/java/com/github/weisj/darklaf/theme/SolarizedLightTheme.java
  21. 53
      theme/src/main/java/com/github/weisj/darklaf/theme/Theme.java
  22. 0
      theme/src/main/java/com/github/weisj/darklaf/theme/ThemeProvider.java
  23. 0
      theme/src/main/java/com/github/weisj/darklaf/theme/UnsupportedThemeException.java
  24. 0
      theme/src/main/resources/com/github/weisj/darklaf/theme/darcula/darcula_defaults.properties
  25. 0
      theme/src/main/resources/com/github/weisj/darklaf/theme/darcula/darcula_styleSheet.css
  26. 0
      theme/src/main/resources/com/github/weisj/darklaf/theme/high_contrast_dark/high_contrast_dark_defaults.properties
  27. 0
      theme/src/main/resources/com/github/weisj/darklaf/theme/high_contrast_dark/high_contrast_dark_icons.properties
  28. 0
      theme/src/main/resources/com/github/weisj/darklaf/theme/high_contrast_dark/high_contrast_dark_platform.properties
  29. 0
      theme/src/main/resources/com/github/weisj/darklaf/theme/high_contrast_dark/high_contrast_dark_styleSheet.css
  30. 0
      theme/src/main/resources/com/github/weisj/darklaf/theme/high_contrast_dark/high_contrast_dark_ui.properties
  31. 0
      theme/src/main/resources/com/github/weisj/darklaf/theme/high_contrast_light/high_contrast_light_defaults.properties
  32. 0
      theme/src/main/resources/com/github/weisj/darklaf/theme/high_contrast_light/high_contrast_light_icons.properties
  33. 0
      theme/src/main/resources/com/github/weisj/darklaf/theme/high_contrast_light/high_contrast_light_platform.properties
  34. 0
      theme/src/main/resources/com/github/weisj/darklaf/theme/high_contrast_light/high_contrast_light_styleSheet.css
  35. 0
      theme/src/main/resources/com/github/weisj/darklaf/theme/high_contrast_light/high_contrast_light_ui.properties
  36. 0
      theme/src/main/resources/com/github/weisj/darklaf/theme/icon_presets/dark_icons.properties
  37. 0
      theme/src/main/resources/com/github/weisj/darklaf/theme/icon_presets/light_icons.properties
  38. 0
      theme/src/main/resources/com/github/weisj/darklaf/theme/intellij/intellij_defaults.properties
  39. 0
      theme/src/main/resources/com/github/weisj/darklaf/theme/intellij/intellij_styleSheet.css
  40. 0
      theme/src/main/resources/com/github/weisj/darklaf/theme/intellij/intellij_ui.properties
  41. 0
      theme/src/main/resources/com/github/weisj/darklaf/theme/solarized_dark/solarized_dark_defaults.properties
  42. 0
      theme/src/main/resources/com/github/weisj/darklaf/theme/solarized_dark/solarized_dark_icons.properties
  43. 0
      theme/src/main/resources/com/github/weisj/darklaf/theme/solarized_dark/solarized_dark_styleSheet.css
  44. 0
      theme/src/main/resources/com/github/weisj/darklaf/theme/solarized_dark/solarized_dark_ui.properties
  45. 0
      theme/src/main/resources/com/github/weisj/darklaf/theme/solarized_light/solarized_light_defaults.properties
  46. 0
      theme/src/main/resources/com/github/weisj/darklaf/theme/solarized_light/solarized_light_icons.properties
  47. 0
      theme/src/main/resources/com/github/weisj/darklaf/theme/solarized_light/solarized_light_styleSheet.css
  48. 0
      theme/src/main/resources/com/github/weisj/darklaf/theme/solarized_light/solarized_light_ui.properties

1
core/build.gradle.kts

@ -8,6 +8,7 @@ plugins {
} }
dependencies { dependencies {
implementation(project(":darklaf-theme"))
implementation(project(":darklaf-native-utils")) implementation(project(":darklaf-native-utils"))
implementation(project(":darklaf-utils")) implementation(project(":darklaf-utils"))
implementation(project(":darklaf-platform-base")) implementation(project(":darklaf-platform-base"))

5
core/src/main/java/com/github/weisj/darklaf/task/FontDefaultsInitTask.java

@ -47,6 +47,7 @@ public class FontDefaultsInitTask implements DefaultsInitTask {
private static final String MAC_OS_CATALINA_FONT_NAME = ".AppleSystemUIFont"; private static final String MAC_OS_CATALINA_FONT_NAME = ".AppleSystemUIFont";
private static final String MAC_OS_FONT_NAME = ".SF NS Text"; private static final String MAC_OS_FONT_NAME = ".SF NS Text";
private final PropertyFontMapper fontMapper = new PropertyFontMapper();
@Override @Override
public void run(final Theme currentTheme, final Map<Object, Object> defaults) { public void run(final Theme currentTheme, final Map<Object, Object> defaults) {
@ -108,7 +109,7 @@ public class FontDefaultsInitTask implements DefaultsInitTask {
} }
private FontMapper getFontMapper(final FontSizeRule rule) { private FontMapper getFontMapper(final FontSizeRule rule) {
if (rule == null) return (font, defaults) -> font; fontMapper.setPropertyKey(rule == null ? null : rule.getPropertyKey());
return rule.getFontMapper(); return fontMapper;
} }
} }

13
core/src/main/java/com/github/weisj/darklaf/theme/PropertyFontMapper.java → core/src/main/java/com/github/weisj/darklaf/task/PropertyFontMapper.java

@ -21,9 +21,11 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE. * SOFTWARE.
*/ */
package com.github.weisj.darklaf.theme; package com.github.weisj.darklaf.task;
import com.github.weisj.darklaf.LafManager; import com.github.weisj.darklaf.LafManager;
import com.github.weisj.darklaf.theme.FontMapper;
import com.github.weisj.darklaf.theme.Theme;
import java.awt.*; import java.awt.*;
import java.util.Map; import java.util.Map;
@ -37,12 +39,21 @@ public class PropertyFontMapper implements FontMapper {
private int adjustment; private int adjustment;
private String propertyKey; private String propertyKey;
public PropertyFontMapper() {
this(null);
}
public PropertyFontMapper(final String propertyKey) { public PropertyFontMapper(final String propertyKey) {
this.propertyKey = propertyKey; this.propertyKey = propertyKey;
} }
public void setPropertyKey(final String propertyKey) {
this.propertyKey = propertyKey;
}
@Override @Override
public Font map(final Font font, final Map<Object, Object> defaults) { public Font map(final Font font, final Map<Object, Object> defaults) {
if (propertyKey == null) return font;
adjustment = getSize(defaults); adjustment = getSize(defaults);
// No need to create a new font. // No need to create a new font.
if (adjustment == 0) return font; if (adjustment == 0) return font;

63
core/src/main/java/com/github/weisj/darklaf/task/ThemeDefaultsInitTask.java

@ -23,13 +23,14 @@
*/ */
package com.github.weisj.darklaf.task; package com.github.weisj.darklaf.task;
import com.github.weisj.darklaf.DarkLaf;
import com.github.weisj.darklaf.PropertyLoader;
import com.github.weisj.darklaf.platform.Decorations; import com.github.weisj.darklaf.platform.Decorations;
import com.github.weisj.darklaf.theme.Theme; import com.github.weisj.darklaf.theme.Theme;
import com.github.weisj.darklaf.util.SystemInfo; import com.github.weisj.darklaf.util.SystemInfo;
import javax.swing.*; import javax.swing.*;
import javax.swing.text.html.HTMLEditorKit; import javax.swing.text.html.HTMLEditorKit;
import javax.swing.text.html.StyleSheet;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.Properties; import java.util.Properties;
@ -38,6 +39,16 @@ public class ThemeDefaultsInitTask implements DefaultsInitTask {
private static final String GLOBAL_PREFIX = "global."; private static final String GLOBAL_PREFIX = "global.";
private static final String MAC_OS_MENU_BAR_KEY = "apple.laf.useScreenMenuBar"; private static final String MAC_OS_MENU_BAR_KEY = "apple.laf.useScreenMenuBar";
private static final String[] UI_PROPERTIES = new String[]{
"borders", "button", "checkBox", "colorChooser", "comboBox", "fileChooser", "tristate",
"internalFrame", "label", "list", "menu", "menuBar", "menuItem", "numberingPane", "optionPane", "panel",
"popupMenu", "progressBar", "radioButton", "rootPane", "scrollBar", "scrollPane", "separator",
"slider", "spinner", "splitPane", "statusBar", "tabbedPane", "tabFrame", "table", "taskPane", "text",
"toggleButton", "toolBar", "toolTip", "tree",
};
private static final String[] ICON_PROPERTIES = new String[]{
"control", "dialog", "files", "frame", "indicator", "menu", "misc", "navigation"
};
private final DefaultsInitTask userPreferenceInitTask = new UserPreferenceInitTask(); private final DefaultsInitTask userPreferenceInitTask = new UserPreferenceInitTask();
@Override @Override
@ -56,17 +67,24 @@ public class ThemeDefaultsInitTask implements DefaultsInitTask {
*/ */
userPreferenceInitTask.run(currentTheme, uiProps); userPreferenceInitTask.run(currentTheme, uiProps);
currentTheme.loadGlobals(uiProps, defaults); initGlobals(currentTheme, defaults, uiProps);
installGlobals(uiProps, defaults); initUIProperties(currentTheme, defaults, uiProps);
currentTheme.loadUIProperties(uiProps, defaults); initIconTheme(currentTheme, defaults, uiProps);
currentTheme.loadIconProperties(uiProps, defaults); initPlatformProperties(currentTheme, defaults, uiProps);
Decorations.loadDecorationProperties(uiProps, defaults); Decorations.loadDecorationProperties(uiProps, defaults);
currentTheme.loadPlatformProperties(uiProps, defaults);
adjustPlatformSpecifics(uiProps); adjustPlatformSpecifics(uiProps);
defaults.putAll(uiProps); defaults.putAll(uiProps);
StyleSheet styleSheet = currentTheme.loadStyleSheet(); new HTMLEditorKit().setStyleSheet(currentTheme.loadStyleSheet());
new HTMLEditorKit().setStyleSheet(styleSheet); }
private void initGlobals(final Theme currentTheme, final UIDefaults defaults, final Properties uiProps) {
PropertyLoader.putProperties(
PropertyLoader.loadProperties(DarkLaf.class, "globals", "properties/"), uiProps, defaults);
currentTheme.customizeGlobals(uiProps, defaults);
installGlobals(uiProps, defaults);
} }
private void installGlobals(final Properties uiProps, final Map<Object, Object> defaults) { private void installGlobals(final Properties uiProps, final Map<Object, Object> defaults) {
@ -88,7 +106,30 @@ public class ThemeDefaultsInitTask implements DefaultsInitTask {
} }
} }
protected void adjustPlatformSpecifics(final Properties uiProps) { private void initUIProperties(final Theme currentTheme, final UIDefaults defaults, final Properties uiProps) {
for (String property : UI_PROPERTIES) {
PropertyLoader.putProperties(
PropertyLoader.loadProperties(DarkLaf.class, property, "properties/ui/"), uiProps, defaults);
}
currentTheme.customizeUIProperties(uiProps, defaults);
}
private void initIconTheme(final Theme currentTheme, final UIDefaults defaults, final Properties uiProps) {
currentTheme.loadIconTheme(uiProps, defaults);
for (String property : ICON_PROPERTIES) {
PropertyLoader.putProperties(
PropertyLoader.loadProperties(DarkLaf.class, property, "properties/icons/"), uiProps, defaults);
}
currentTheme.customizeIconTheme(uiProps, defaults);
}
private void initPlatformProperties(final Theme currentTheme, final UIDefaults defaults, final Properties uiProps) {
PropertyLoader.putProperties(
PropertyLoader.loadProperties(DarkLaf.class, getOsName(), "properties/platform/"), uiProps, defaults);
currentTheme.customizePlatformProperties(uiProps, defaults);
}
private void adjustPlatformSpecifics(final Properties uiProps) {
boolean useScreenMenuBar = Boolean.getBoolean(MAC_OS_MENU_BAR_KEY); boolean useScreenMenuBar = Boolean.getBoolean(MAC_OS_MENU_BAR_KEY);
// If user wants to use Apple menu bar, then we need to keep the default // If user wants to use Apple menu bar, then we need to keep the default
// component for MenuBarUI and MenuUI // component for MenuBarUI and MenuUI
@ -96,4 +137,8 @@ public class ThemeDefaultsInitTask implements DefaultsInitTask {
uiProps.remove("MenuBarUI"); uiProps.remove("MenuBarUI");
} }
} }
private String getOsName() {
return SystemInfo.isMac ? "mac" : SystemInfo.isWindows ? "windows" : "linux";
}
} }

12
core/src/test/java/theme/MyCustomTheme.java

@ -34,8 +34,8 @@ import java.util.Properties;
public class MyCustomTheme extends Theme { public class MyCustomTheme extends Theme {
@Override @Override
public void loadGlobals(final Properties properties, final UIDefaults currentDefaults) { public void customizeGlobals(final Properties properties, final UIDefaults currentDefaults) {
super.loadGlobals(properties, currentDefaults); super.customizeGlobals(properties, currentDefaults);
/* /*
* Properties in the globals file should have a 'globals.' to be applied globally. * Properties in the globals file should have a 'globals.' to be applied globally.
*/ */
@ -43,8 +43,8 @@ public class MyCustomTheme extends Theme {
} }
@Override @Override
public void loadPlatformProperties(final Properties properties, final UIDefaults currentDefaults) { public void customizePlatformProperties(final Properties properties, final UIDefaults currentDefaults) {
super.loadPlatformProperties(properties, currentDefaults); super.customizePlatformProperties(properties, currentDefaults);
/* /*
* Loading this file (and having it present) is optional. * Loading this file (and having it present) is optional.
*/ */
@ -53,8 +53,8 @@ public class MyCustomTheme extends Theme {
} }
@Override @Override
public void loadUIProperties(final Properties properties, final UIDefaults currentDefaults) { public void customizeUIProperties(final Properties properties, final UIDefaults currentDefaults) {
super.loadUIProperties(properties, currentDefaults); super.customizeUIProperties(properties, currentDefaults);
/* /*
* Loading this file (and having it present) is optional. * Loading this file (and having it present) is optional.
*/ */

1
settings.gradle.kts

@ -18,6 +18,7 @@ include(
"dependencies-bom", "dependencies-bom",
"native-utils", "native-utils",
"core", "core",
"theme",
"property-loader", "property-loader",
"utils", "utils",
"platform-base", "platform-base",

7
theme/build.gradle.kts

@ -0,0 +1,7 @@
plugins {
`java-library`
}
dependencies {
implementation(project(":darklaf-property-loader"))
}

0
core/src/main/java/com/github/weisj/darklaf/theme/ColorToneRule.java → theme/src/main/java/com/github/weisj/darklaf/theme/ColorToneRule.java

0
core/src/main/java/com/github/weisj/darklaf/theme/ContrastRule.java → theme/src/main/java/com/github/weisj/darklaf/theme/ContrastRule.java

0
core/src/main/java/com/github/weisj/darklaf/theme/DarculaTheme.java → theme/src/main/java/com/github/weisj/darklaf/theme/DarculaTheme.java

0
core/src/main/java/com/github/weisj/darklaf/theme/DefaultThemeProvider.java → theme/src/main/java/com/github/weisj/darklaf/theme/DefaultThemeProvider.java

0
core/src/main/java/com/github/weisj/darklaf/theme/FontMapper.java → theme/src/main/java/com/github/weisj/darklaf/theme/FontMapper.java

6
core/src/main/java/com/github/weisj/darklaf/theme/FontSizeRule.java → theme/src/main/java/com/github/weisj/darklaf/theme/FontSizeRule.java

@ -34,18 +34,12 @@ public enum FontSizeRule {
HUGE("huge"); HUGE("huge");
private final String propertyKey; private final String propertyKey;
private final PropertyFontMapper fontMapper;
FontSizeRule(final String propertyKey) { FontSizeRule(final String propertyKey) {
this.propertyKey = propertyKey; this.propertyKey = propertyKey;
fontMapper = new PropertyFontMapper(getPropertyKey());
} }
public String getPropertyKey() { public String getPropertyKey() {
return "fontSize." + propertyKey; return "fontSize." + propertyKey;
} }
public FontMapper getFontMapper() {
return fontMapper;
}
} }

8
core/src/main/java/com/github/weisj/darklaf/theme/HighContrastDarkTheme.java → theme/src/main/java/com/github/weisj/darklaf/theme/HighContrastDarkTheme.java

@ -64,14 +64,14 @@ public class HighContrastDarkTheme extends Theme {
} }
@Override @Override
public void loadUIProperties(final Properties properties, final UIDefaults currentDefaults) { public void customizeUIProperties(final Properties properties, final UIDefaults currentDefaults) {
super.loadUIProperties(properties, currentDefaults); super.customizeUIProperties(properties, currentDefaults);
loadCustomProperties("ui", properties, currentDefaults); loadCustomProperties("ui", properties, currentDefaults);
} }
@Override @Override
public void loadPlatformProperties(final Properties properties, final UIDefaults currentDefaults) { public void customizePlatformProperties(final Properties properties, final UIDefaults currentDefaults) {
super.loadPlatformProperties(properties, currentDefaults); super.customizePlatformProperties(properties, currentDefaults);
loadCustomProperties("platform", properties, currentDefaults); loadCustomProperties("platform", properties, currentDefaults);
} }
} }

8
core/src/main/java/com/github/weisj/darklaf/theme/HighContrastLightTheme.java → theme/src/main/java/com/github/weisj/darklaf/theme/HighContrastLightTheme.java

@ -64,14 +64,14 @@ public class HighContrastLightTheme extends Theme {
} }
@Override @Override
public void loadUIProperties(final Properties properties, final UIDefaults currentDefaults) { public void customizeUIProperties(final Properties properties, final UIDefaults currentDefaults) {
super.loadUIProperties(properties, currentDefaults); super.customizeUIProperties(properties, currentDefaults);
loadCustomProperties("ui", properties, currentDefaults); loadCustomProperties("ui", properties, currentDefaults);
} }
@Override @Override
public void loadPlatformProperties(final Properties properties, final UIDefaults currentDefaults) { public void customizePlatformProperties(final Properties properties, final UIDefaults currentDefaults) {
super.loadPlatformProperties(properties, currentDefaults); super.customizePlatformProperties(properties, currentDefaults);
loadCustomProperties("platform", properties, currentDefaults); loadCustomProperties("platform", properties, currentDefaults);
} }
} }

4
core/src/main/java/com/github/weisj/darklaf/theme/IntelliJTheme.java → theme/src/main/java/com/github/weisj/darklaf/theme/IntelliJTheme.java

@ -62,8 +62,8 @@ public class IntelliJTheme extends Theme {
} }
@Override @Override
public void loadUIProperties(final Properties properties, final UIDefaults currentDefaults) { public void customizeUIProperties(final Properties properties, final UIDefaults currentDefaults) {
super.loadUIProperties(properties, currentDefaults); super.customizeUIProperties(properties, currentDefaults);
loadCustomProperties("ui", properties, currentDefaults); loadCustomProperties("ui", properties, currentDefaults);
} }
} }

0
core/src/main/java/com/github/weisj/darklaf/theme/PreferredThemeStyle.java → theme/src/main/java/com/github/weisj/darklaf/theme/PreferredThemeStyle.java

0
core/src/main/java/com/github/weisj/darklaf/theme/PresetIconRule.java → theme/src/main/java/com/github/weisj/darklaf/theme/PresetIconRule.java

4
core/src/main/java/com/github/weisj/darklaf/theme/SolarizedDarkTheme.java → theme/src/main/java/com/github/weisj/darklaf/theme/SolarizedDarkTheme.java

@ -54,8 +54,8 @@ public class SolarizedDarkTheme extends Theme {
} }
@Override @Override
public void loadUIProperties(final Properties properties, final UIDefaults currentDefaults) { public void customizeUIProperties(final Properties properties, final UIDefaults currentDefaults) {
super.loadUIProperties(properties, currentDefaults); super.customizeUIProperties(properties, currentDefaults);
loadCustomProperties("ui", properties, currentDefaults); loadCustomProperties("ui", properties, currentDefaults);
} }

4
core/src/main/java/com/github/weisj/darklaf/theme/SolarizedLightTheme.java → theme/src/main/java/com/github/weisj/darklaf/theme/SolarizedLightTheme.java

@ -54,8 +54,8 @@ public class SolarizedLightTheme extends Theme {
} }
@Override @Override
public void loadUIProperties(final Properties properties, final UIDefaults currentDefaults) { public void customizeUIProperties(final Properties properties, final UIDefaults currentDefaults) {
super.loadUIProperties(properties, currentDefaults); super.customizeUIProperties(properties, currentDefaults);
loadCustomProperties("ui", properties, currentDefaults); loadCustomProperties("ui", properties, currentDefaults);
} }

53
core/src/main/java/com/github/weisj/darklaf/theme/Theme.java → theme/src/main/java/com/github/weisj/darklaf/theme/Theme.java

@ -23,9 +23,7 @@
*/ */
package com.github.weisj.darklaf.theme; package com.github.weisj.darklaf.theme;
import com.github.weisj.darklaf.DarkLaf;
import com.github.weisj.darklaf.PropertyLoader; import com.github.weisj.darklaf.PropertyLoader;
import com.github.weisj.darklaf.util.SystemInfo;
import javax.swing.*; import javax.swing.*;
import javax.swing.text.html.StyleSheet; import javax.swing.text.html.StyleSheet;
@ -39,22 +37,10 @@ import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
/** /**
* Theme for {@link DarkLaf}.
*
* @author Jannis Weis * @author Jannis Weis
*/ */
public abstract class Theme { public abstract class Theme {
private static final Logger LOGGER = Logger.getLogger(Theme.class.getName()); private static final Logger LOGGER = Logger.getLogger(Theme.class.getName());
private static final String[] UI_PROPERTIES = new String[]{
"borders", "button", "checkBox", "colorChooser", "comboBox", "fileChooser", "tristate",
"internalFrame", "label", "list", "menu", "menuBar", "menuItem", "numberingPane", "optionPane", "panel",
"popupMenu", "progressBar", "radioButton", "rootPane", "scrollBar", "scrollPane", "separator",
"slider", "spinner", "splitPane", "statusBar", "tabbedPane", "tabFrame", "table", "taskPane", "text",
"toggleButton", "toolBar", "toolTip", "tree",
};
private static final String[] ICON_PROPERTIES = new String[]{
"control", "dialog", "files", "frame", "indicator", "menu", "misc", "navigation"
};
private FontSizeRule fontSizeRule; private FontSizeRule fontSizeRule;
@ -96,7 +82,7 @@ public abstract class Theme {
} }
/** /**
* Load the global values. * Customize the global values.
* <p> * <p>
* Note: When overwriting a theme you also have overwrite {@link #getLoaderClass()} to return the class of the theme * Note: When overwriting a theme you also have overwrite {@link #getLoaderClass()} to return the class of the theme
* you are overwriting. In this case you should use {@link #loadWithClass(String, Class)} instead of {@link * you are overwriting. In this case you should use {@link #loadWithClass(String, Class)} instead of {@link
@ -105,13 +91,11 @@ public abstract class Theme {
* @param properties the properties to load the values into. * @param properties the properties to load the values into.
* @param currentDefaults the current ui defaults. * @param currentDefaults the current ui defaults.
*/ */
public void loadGlobals(final Properties properties, final UIDefaults currentDefaults) { public void customizeGlobals(final Properties properties, final UIDefaults currentDefaults) {
PropertyLoader.putProperties(PropertyLoader.loadProperties(DarkLaf.class, "globals", "properties/"),
properties, currentDefaults);
} }
/** /**
* Load the icon defaults. * Customize the icon defaults.
* <p> * <p>
* Note: When overwriting a theme you also have overwrite {@link #getLoaderClass()} to return the class of the theme * Note: When overwriting a theme you also have overwrite {@link #getLoaderClass()} to return the class of the theme
* you are overwriting. In this case you should use {@link #loadWithClass(String, Class)} instead of {@link * you are overwriting. In this case you should use {@link #loadWithClass(String, Class)} instead of {@link
@ -120,12 +104,7 @@ public abstract class Theme {
* @param properties the properties to load the value into. * @param properties the properties to load the value into.
* @param currentDefaults the current ui defaults. * @param currentDefaults the current ui defaults.
*/ */
public void loadIconProperties(final Properties properties, final UIDefaults currentDefaults) { public void customizeIconTheme(final Properties properties, final UIDefaults currentDefaults) {
loadIconTheme(properties, currentDefaults);
for (String property : ICON_PROPERTIES) {
PropertyLoader.putProperties(PropertyLoader.loadProperties(DarkLaf.class, property, "properties/icons/"),
properties, currentDefaults);
}
} }
/** /**
@ -138,15 +117,15 @@ public abstract class Theme {
* @param properties the properties to load the value into. * @param properties the properties to load the value into.
* @param currentDefaults the current ui defaults. * @param currentDefaults the current ui defaults.
*/ */
protected void loadIconTheme(final Properties properties, final UIDefaults currentDefaults) { public void loadIconTheme(final Properties properties, final UIDefaults currentDefaults) {
PresetIconRule iconTheme = getPresetIconRule(); PresetIconRule iconTheme = getPresetIconRule();
Properties props; Properties props;
switch (iconTheme) { switch (iconTheme) {
case DARK: case DARK:
props = PropertyLoader.loadProperties(DarkLaf.class, "dark_icons", "properties/icons/presets/"); props = PropertyLoader.loadProperties(Theme.class, "dark_icons", "icon_presets/");
break; break;
case LIGHT: case LIGHT:
props = PropertyLoader.loadProperties(DarkLaf.class, "light_icons", "properties/icons/presets/"); props = PropertyLoader.loadProperties(Theme.class, "light_icons", "icon_presets/");
break; break;
case NONE: case NONE:
default: default:
@ -156,7 +135,7 @@ public abstract class Theme {
} }
/** /**
* Load the platform defaults. * Customize the platform defaults.
* <p> * <p>
* Note: When overwriting a theme you should use {@link #loadWithClass(String, Class)} instead of {@link * Note: When overwriting a theme you should use {@link #loadWithClass(String, Class)} instead of {@link
* #load(String)}. * #load(String)}.
@ -164,17 +143,11 @@ public abstract class Theme {
* @param properties the properties to load the values into. * @param properties the properties to load the values into.
* @param currentDefaults the current ui defaults. * @param currentDefaults the current ui defaults.
*/ */
public void loadPlatformProperties(final Properties properties, final UIDefaults currentDefaults) { public void customizePlatformProperties(final Properties properties, final UIDefaults currentDefaults) {
PropertyLoader.putProperties(PropertyLoader.loadProperties(DarkLaf.class, getOsName(), "properties/platform/"),
properties, currentDefaults);
}
private String getOsName() {
return SystemInfo.isMac ? "mac" : SystemInfo.isWindows ? "windows" : "linux";
} }
/** /**
* Load the ui defaults. * Customize the ui defaults.
* <p> * <p>
* Note: When overwriting a theme you should use {@link #loadWithClass(String, Class)} instead of {@link * Note: When overwriting a theme you should use {@link #loadWithClass(String, Class)} instead of {@link
* #load(String)}. * #load(String)}.
@ -182,11 +155,7 @@ public abstract class Theme {
* @param properties the properties to load the values into. * @param properties the properties to load the values into.
* @param currentDefaults the current ui defaults. * @param currentDefaults the current ui defaults.
*/ */
public void loadUIProperties(final Properties properties, final UIDefaults currentDefaults) { public void customizeUIProperties(final Properties properties, final UIDefaults currentDefaults) {
for (String property : UI_PROPERTIES) {
PropertyLoader.putProperties(PropertyLoader.loadProperties(DarkLaf.class, property, "properties/ui/"),
properties, currentDefaults);
}
} }
/** /**

0
core/src/main/java/com/github/weisj/darklaf/theme/ThemeProvider.java → theme/src/main/java/com/github/weisj/darklaf/theme/ThemeProvider.java

0
core/src/main/java/com/github/weisj/darklaf/theme/UnsupportedThemeException.java → theme/src/main/java/com/github/weisj/darklaf/theme/UnsupportedThemeException.java

0
core/src/main/resources/com/github/weisj/darklaf/theme/darcula/darcula_defaults.properties → theme/src/main/resources/com/github/weisj/darklaf/theme/darcula/darcula_defaults.properties

0
core/src/main/resources/com/github/weisj/darklaf/theme/darcula/darcula_styleSheet.css → theme/src/main/resources/com/github/weisj/darklaf/theme/darcula/darcula_styleSheet.css

0
core/src/main/resources/com/github/weisj/darklaf/theme/high_contrast_dark/high_contrast_dark_defaults.properties → theme/src/main/resources/com/github/weisj/darklaf/theme/high_contrast_dark/high_contrast_dark_defaults.properties

0
core/src/main/resources/com/github/weisj/darklaf/theme/high_contrast_dark/high_contrast_dark_icons.properties → theme/src/main/resources/com/github/weisj/darklaf/theme/high_contrast_dark/high_contrast_dark_icons.properties

0
core/src/main/resources/com/github/weisj/darklaf/theme/high_contrast_dark/high_contrast_dark_platform.properties → theme/src/main/resources/com/github/weisj/darklaf/theme/high_contrast_dark/high_contrast_dark_platform.properties

0
core/src/main/resources/com/github/weisj/darklaf/theme/high_contrast_dark/high_contrast_dark_styleSheet.css → theme/src/main/resources/com/github/weisj/darklaf/theme/high_contrast_dark/high_contrast_dark_styleSheet.css

0
core/src/main/resources/com/github/weisj/darklaf/theme/high_contrast_dark/high_contrast_dark_ui.properties → theme/src/main/resources/com/github/weisj/darklaf/theme/high_contrast_dark/high_contrast_dark_ui.properties

0
core/src/main/resources/com/github/weisj/darklaf/theme/high_contrast_light/high_contrast_light_defaults.properties → theme/src/main/resources/com/github/weisj/darklaf/theme/high_contrast_light/high_contrast_light_defaults.properties

0
core/src/main/resources/com/github/weisj/darklaf/theme/high_contrast_light/high_contrast_light_icons.properties → theme/src/main/resources/com/github/weisj/darklaf/theme/high_contrast_light/high_contrast_light_icons.properties

0
core/src/main/resources/com/github/weisj/darklaf/theme/high_contrast_light/high_contrast_light_platform.properties → theme/src/main/resources/com/github/weisj/darklaf/theme/high_contrast_light/high_contrast_light_platform.properties

0
core/src/main/resources/com/github/weisj/darklaf/theme/high_contrast_light/high_contrast_light_styleSheet.css → theme/src/main/resources/com/github/weisj/darklaf/theme/high_contrast_light/high_contrast_light_styleSheet.css

0
core/src/main/resources/com/github/weisj/darklaf/theme/high_contrast_light/high_contrast_light_ui.properties → theme/src/main/resources/com/github/weisj/darklaf/theme/high_contrast_light/high_contrast_light_ui.properties

0
core/src/main/resources/com/github/weisj/darklaf/properties/icons/presets/dark_icons.properties → theme/src/main/resources/com/github/weisj/darklaf/theme/icon_presets/dark_icons.properties

0
core/src/main/resources/com/github/weisj/darklaf/properties/icons/presets/light_icons.properties → theme/src/main/resources/com/github/weisj/darklaf/theme/icon_presets/light_icons.properties

0
core/src/main/resources/com/github/weisj/darklaf/theme/intellij/intellij_defaults.properties → theme/src/main/resources/com/github/weisj/darklaf/theme/intellij/intellij_defaults.properties

0
core/src/main/resources/com/github/weisj/darklaf/theme/intellij/intellij_styleSheet.css → theme/src/main/resources/com/github/weisj/darklaf/theme/intellij/intellij_styleSheet.css

0
core/src/main/resources/com/github/weisj/darklaf/theme/intellij/intellij_ui.properties → theme/src/main/resources/com/github/weisj/darklaf/theme/intellij/intellij_ui.properties

0
core/src/main/resources/com/github/weisj/darklaf/theme/solarized_dark/solarized_dark_defaults.properties → theme/src/main/resources/com/github/weisj/darklaf/theme/solarized_dark/solarized_dark_defaults.properties

0
core/src/main/resources/com/github/weisj/darklaf/theme/solarized_dark/solarized_dark_icons.properties → theme/src/main/resources/com/github/weisj/darklaf/theme/solarized_dark/solarized_dark_icons.properties

0
core/src/main/resources/com/github/weisj/darklaf/theme/solarized_dark/solarized_dark_styleSheet.css → theme/src/main/resources/com/github/weisj/darklaf/theme/solarized_dark/solarized_dark_styleSheet.css

0
core/src/main/resources/com/github/weisj/darklaf/theme/solarized_dark/solarized_dark_ui.properties → theme/src/main/resources/com/github/weisj/darklaf/theme/solarized_dark/solarized_dark_ui.properties

0
core/src/main/resources/com/github/weisj/darklaf/theme/solarized_light/solarized_light_defaults.properties → theme/src/main/resources/com/github/weisj/darklaf/theme/solarized_light/solarized_light_defaults.properties

0
core/src/main/resources/com/github/weisj/darklaf/theme/solarized_light/solarized_light_icons.properties → theme/src/main/resources/com/github/weisj/darklaf/theme/solarized_light/solarized_light_icons.properties

0
core/src/main/resources/com/github/weisj/darklaf/theme/solarized_light/solarized_light_styleSheet.css → theme/src/main/resources/com/github/weisj/darklaf/theme/solarized_light/solarized_light_styleSheet.css

0
core/src/main/resources/com/github/weisj/darklaf/theme/solarized_light/solarized_light_ui.properties → theme/src/main/resources/com/github/weisj/darklaf/theme/solarized_light/solarized_light_ui.properties

Loading…
Cancel
Save