aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/cc/polyfrost/oneconfig/config/OneConfigConfig.java
blob: 376f221602c5ab35db230ac393bd34c85f552b32 (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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
package cc.polyfrost.oneconfig.config;

import cc.polyfrost.oneconfig.config.core.OneColor;
import cc.polyfrost.oneconfig.config.data.Mod;
import cc.polyfrost.oneconfig.config.interfaces.Config;
import com.google.gson.JsonParser;

import java.awt.*;
import java.io.*;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.ArrayList;

public class OneConfigConfig extends Config {

    public static String currentProfile = "Default Profile";
    public static ArrayList<String> favoriteMods = new ArrayList<>();
    public static ArrayList<OneColor> favoriteColors = new ArrayList<>();
    public static ArrayList<OneColor> recentColors = new ArrayList<>();


    // the color library
    public static final int TRANSPARENT = new Color(0, 0, 0, 0).getRGB();                // Transparent

    public static final int BLACK = new Color(0, 0, 0, 255).getRGB();                     // Black
    public static final int GRAY_900 = new Color(13, 14, 15, 255).getRGB();           // Gray 900
    public static final int GRAY_900_80 = new Color(13, 14, 15, 204).getRGB();         // Gray 900 80%
    public static final int GRAY_800 = new Color(21, 22, 23, 255).getRGB();           // Gray 800
    public static final int GRAY_700 = new Color(34, 35, 38, 255).getRGB();           // Gray 700
    public static final int GRAY_600 = new Color(42, 44, 48, 255).getRGB();           // Gray 600
    public static final int GRAY_500 = new Color(49, 51, 56, 255).getRGB();           // Gray 500         // button sidebar hover, button gray normal
    public static final int GRAY_500_80 = new Color(49, 51, 56, 204).getRGB();        // Gray 500 80%     // button sidebar pressed
    public static final int GRAY_400 = new Color(55, 59, 69, 255).getRGB();           // Gray 400
    public static final int GRAY_300 = new Color(73, 79, 92, 255).getRGB();           // Gray 300         // button gray hover
    public static final int GRAY_400_80 = new Color(55, 59, 69, 204).getRGB();        // Gray 400 80%     // button gray pressed
    public static final int PRIMARY_800 = new Color(13, 51, 128, 255).getRGB();          // Blue 800
    public static final int PRIMARY_700 = new Color(18, 71, 178, 255).getRGB();          // Blue 700
    public static final int PRIMARY_700_80 = new Color(18, 71, 178, 204).getRGB();       // Blue 700 80%
    public static final int PRIMARY_600 = new Color(20, 82, 204, 255).getRGB();          // Blue 600         // button blue normal
    public static final int PRIMARY_500 = new Color(25, 103, 255, 255).getRGB();         // Blue 500         // button blue hover
    public static final int PRIMARY_400 = new Color(48, 129, 242, 255).getRGB();
    public static final int WHITE_50 = new Color(255, 255, 255, 127).getRGB();        // White 60%
    public static final int WHITE_60 = new Color(255, 255, 255, 153).getRGB();        // White 60%
    public static final int WHITE_80 = new Color(255, 255, 255, 204).getRGB();        // White 80%
    public static final int WHITE_90 = new Color(255, 255, 255, 229).getRGB();        // White 90%
    public static final int WHITE_95 = new Color(255, 255, 255, 242).getRGB();        // White 90%
    public static final int WHITE = new Color(255, 255, 255, 255).getRGB();           // White 100%
    public static final int SUCCESS_600 = new Color(3, 152, 85).getRGB();
    public static final int SUCCESS_700 = new Color(2, 121, 72).getRGB();
    public static final int WARNING_500 = new Color(247, 144, 9).getRGB();
    public static final int WARNING_600 = new Color(220, 104, 3).getRGB();
    public static final int ERROR_600_80 = new Color(217, 32, 32, 204).getRGB();
    public static final int ERROR_600 = new Color(217, 32, 32).getRGB();
    public static final int ERROR_700 = new Color(180, 24, 24).getRGB();         // Red 700
    public static final int ERROR_800 = new Color(145, 24, 24).getRGB();         // Red 800
    public static final int ERROR_800_80 = new Color(145, 24, 24, 204).getRGB();         // Red 800
    public static final int ERROR_300 = new Color(253, 155, 155).getRGB();
    public static final int ERROR_300_80 = new Color(253, 155, 155, 204).getRGB();


    public static boolean ROUNDED_CORNERS = true;
    public static float CORNER_RADIUS_WIN = 20f;
    public static float CORNER_RADIUS = 12f;

    public static boolean allShowShortCut = false;

    public OneConfigConfig() {
        super(null, "OneConfig.json");
    }

    @Override
    public void init(Mod mod) {
        if (new File("OneConfig/" + configFile).exists()) load();
        else save();
    }

    @Override
    public void save() {
        try (BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(Files.newOutputStream(Paths.get("OneConfig/" + configFile)), StandardCharsets.UTF_8))) {
            writer.write(gson.toJson(this));
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    @Override
    public void load() {
        try (BufferedReader reader = new BufferedReader(new InputStreamReader(Files.newInputStream(Paths.get("OneConfig/" + configFile)), StandardCharsets.UTF_8))) {
            deserializePart(new JsonParser().parse(reader).getAsJsonObject(), this);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}