aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io/polyfrost/oneconfig/themes/Themes.java
diff options
context:
space:
mode:
authornextdaydelivery <12willettsh@gmail.com>2022-02-12 11:13:52 +0000
committernextdaydelivery <12willettsh@gmail.com>2022-02-12 11:13:52 +0000
commit2231da6af9982840fa9d3bd24c4333bdbbe19cc2 (patch)
tree29d8d410e15de08349235fdac7d7b0e8cbe6b9d3 /src/main/java/io/polyfrost/oneconfig/themes/Themes.java
parent88df999a8ff35ea30b8fa9cf94c46dd748215581 (diff)
downloadOneConfig-2231da6af9982840fa9d3bd24c4333bdbbe19cc2.tar.gz
OneConfig-2231da6af9982840fa9d3bd24c4333bdbbe19cc2.tar.bz2
OneConfig-2231da6af9982840fa9d3bd24c4333bdbbe19cc2.zip
theme things
Diffstat (limited to 'src/main/java/io/polyfrost/oneconfig/themes/Themes.java')
-rw-r--r--src/main/java/io/polyfrost/oneconfig/themes/Themes.java43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/main/java/io/polyfrost/oneconfig/themes/Themes.java b/src/main/java/io/polyfrost/oneconfig/themes/Themes.java
index 7ba8097..7bff29c 100644
--- a/src/main/java/io/polyfrost/oneconfig/themes/Themes.java
+++ b/src/main/java/io/polyfrost/oneconfig/themes/Themes.java
@@ -1,4 +1,47 @@
package io.polyfrost.oneconfig.themes;
+import io.polyfrost.oneconfig.OneConfig;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
+import java.io.File;
+import java.io.FilenameFilter;
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Objects;
+
public class Themes {
+ public static Theme activeTheme;
+ public static final Logger themeLog = LogManager.getLogger("OneConfig Themes");
+
+ /**
+ * Return a list of all available themes in the directory.
+ * @return list of themes
+ */
+ public static List<File> getThemes() {
+ FilenameFilter filter = (dir, name) -> name.endsWith(".zip");
+ return Arrays.asList(Objects.requireNonNull(OneConfig.themesDir.listFiles(filter)));
+ }
+
+ /**
+ * Return the active theme instance.
+ */
+ public static Theme getActiveTheme() {
+ return activeTheme;
+ }
+
+ /**
+ * Open a new theme in the window, and restart the GUI.
+ * @param theme Theme file to open
+ */
+ public static void openTheme(File theme) {
+ try {
+ activeTheme = new Theme(theme);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ // TODO restart gui
+ }
+
}