summaryrefslogtreecommitdiff
path: root/src/main/java/cuchaz/enigma/config/Themes.java
diff options
context:
space:
mode:
authorGravatar asie2018-11-28 10:11:47 +0100
committerGravatar asie2018-11-28 10:11:47 +0100
commitca75962a1dd8e5e629d6d4a794d7460dadf430a5 (patch)
tree72c597c69809e1bf5765b21c3ab1756c1cf1c6b4 /src/main/java/cuchaz/enigma/config/Themes.java
parentMove to awt FileDialog (diff)
downloadenigma-fork-ca75962a1dd8e5e629d6d4a794d7460dadf430a5.tar.gz
enigma-fork-ca75962a1dd8e5e629d6d4a794d7460dadf430a5.tar.xz
enigma-fork-ca75962a1dd8e5e629d6d4a794d7460dadf430a5.zip
refactors and bugfixes
Diffstat (limited to 'src/main/java/cuchaz/enigma/config/Themes.java')
-rw-r--r--src/main/java/cuchaz/enigma/config/Themes.java49
1 files changed, 4 insertions, 45 deletions
diff --git a/src/main/java/cuchaz/enigma/config/Themes.java b/src/main/java/cuchaz/enigma/config/Themes.java
index 4b1f478..b3132f2 100644
--- a/src/main/java/cuchaz/enigma/config/Themes.java
+++ b/src/main/java/cuchaz/enigma/config/Themes.java
@@ -14,42 +14,14 @@ import java.io.IOException;
14 14
15public class Themes { 15public class Themes {
16 16
17 public static void setDefault(Gui gui) { 17 public static void setLookAndFeel(Gui gui, Config.LookAndFeel lookAndFeel) {
18 // TODO set to default 18 Config.getInstance().lookAndFeel = lookAndFeel;
19 try {
20 Config.getInstance().reset();
21 } catch (IOException e) {
22 e.printStackTrace();
23 }
24 updateTheme(gui); 19 updateTheme(gui);
25 } 20 }
26 21
27 public static void setDark(Gui gui) {
28 //Based off colors found here: https://github.com/dracula/dracula-theme/
29 Config.getInstance().obfuscatedColor = 0xFF5555;
30 Config.getInstance().obfuscatedHiglightAlpha = 0.3F;
31 Config.getInstance().obfuscatedColorOutline = 0xFF5555;
32 Config.getInstance().obfuscatedOutlineAlpha = 0.5F;
33 Config.getInstance().deobfuscatedColor = 0x50FA7B;
34 Config.getInstance().deobfuscatedHiglightAlpha = 0.3F;
35 Config.getInstance().deobfuscatedColorOutline = 0x50FA7B;
36 Config.getInstance().deobfuscatedOutlineAlpha = 0.5F;
37 Config.getInstance().otherColorOutline = 0xB4B4B4;
38 Config.getInstance().otherOutlineAlpha = 0.0F;
39 Config.getInstance().editorBackground = 0x282A36;
40 Config.getInstance().highlightColor = 0xFF79C6;
41 Config.getInstance().stringColor = 0xF1FA8C;
42 Config.getInstance().numberColor = 0xBD93F9;
43 Config.getInstance().operatorColor = 0xF8F8F2;
44 Config.getInstance().delimiterColor = 0xF8F8F2;
45 Config.getInstance().typeColor = 0xF8F8F2;
46 Config.getInstance().identifierColor = 0xF8F8F2;
47 Config.getInstance().defaultTextColor = 0xF8F8F2;
48 Config.getInstance().useDraculaLAF = true;
49 updateTheme(gui);
50 }
51
52 public static void updateTheme(Gui gui) { 22 public static void updateTheme(Gui gui) {
23 Config.getInstance().lookAndFeel.apply(Config.getInstance());
24 Config.getInstance().lookAndFeel.setGlobalLAF();
53 try { 25 try {
54 Config.getInstance().saveConfig(); 26 Config.getInstance().saveConfig();
55 } catch (IOException e) { 27 } catch (IOException e) {
@@ -63,20 +35,7 @@ public class Themes {
63 gui.otherHighlightPainter = new OtherHighlightPainter(); 35 gui.otherHighlightPainter = new OtherHighlightPainter();
64 gui.editor.updateUI(); 36 gui.editor.updateUI();
65 gui.editor.setBackground(new Color(Config.getInstance().editorBackground)); 37 gui.editor.setBackground(new Color(Config.getInstance().editorBackground));
66 setLAF();
67 SwingUtilities.updateComponentTreeUI(gui.getFrame()); 38 SwingUtilities.updateComponentTreeUI(gui.getFrame());
68 gui.getController().refreshCurrentClass(); 39 gui.getController().refreshCurrentClass();
69 } 40 }
70
71 public static void setLAF(){
72 try {
73 if (Config.getInstance().useDraculaLAF){
74 UIManager.setLookAndFeel(new DarculaLaf());
75 } else if (Config.getInstance().useSystemLAF)
76 UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
77 } catch (Exception e){
78 throw new Error("Failed to set LAF", e);
79 }
80 }
81
82} 41}