diff --git a/core/src/main/java/com/github/weisj/darklaf/task/AccentColorAdjustmentTask.java b/core/src/main/java/com/github/weisj/darklaf/task/AccentColorAdjustmentTask.java index 30a6aebd..0b9634da 100644 --- a/core/src/main/java/com/github/weisj/darklaf/task/AccentColorAdjustmentTask.java +++ b/core/src/main/java/com/github/weisj/darklaf/task/AccentColorAdjustmentTask.java @@ -49,8 +49,8 @@ public class AccentColorAdjustmentTask extends ColorAdjustmentTask { public void applyColors(final Theme currentTheme, final Properties properties, final Color accentColor, final Color selectionColor) { - Properties props = currentTheme.loadPropertyFile("accents", true); - if (props.isEmpty()) return; + Properties props = currentTheme.loadAccentProperties(); + if (props == null || props.isEmpty()) return; if (accentColor != null) { adjustColors(MAIN_ACCENT_LIST_KEY, accentColor, props, properties); } diff --git a/theme/src/main/java/com/github/weisj/darklaf/theme/Theme.java b/theme/src/main/java/com/github/weisj/darklaf/theme/Theme.java index 05849640..4a1fbdc6 100644 --- a/theme/src/main/java/com/github/weisj/darklaf/theme/Theme.java +++ b/theme/src/main/java/com/github/weisj/darklaf/theme/Theme.java @@ -213,6 +213,16 @@ public abstract class Theme implements Comparable, Comparator { PropertyLoader.putProperties(loadPropertyFile(propertySuffix), properties, currentDefaults); } + /** + * Load the properties specifying how to map the colors from the {@link AccentColorRule} are mapped to the + * properties. + * + * @return the properties providing the mapping rules. + */ + public Properties loadAccentProperties() { + return loadPropertyFile("accents", true); + } + /** * Load a .properties file using {@link #getLoaderClass()}} to resolve the file path. *

@@ -235,6 +245,10 @@ public abstract class Theme implements Comparable, Comparator { protected final Properties loadWithClass(final String name, final Class loaderClass) { final Properties properties = new Properties(); try (InputStream stream = loaderClass.getResourceAsStream(name)) { + if (stream == null) { + LOGGER.log(Level.SEVERE, "Could not load " + name + ".properties. File not found"); + return properties; + } properties.load(stream); } catch (Exception e) { LOGGER.log(Level.SEVERE, "Could not load " + name + ".properties. " + e.getMessage(), e.getStackTrace());