blob: 38e5df776f6b13edfe10b2f62c6837e77ef76ebb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
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 final int VERSION = 0;
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
}
}
|