summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Modmuss502018-12-11 00:14:14 +0000
committerGravatar GitHub2018-12-11 00:14:14 +0000
commitd1e81ea5456b2fd5a8c3f5e3685bfdd4cac8a562 (patch)
tree02f405419ac4bd388528183d786d74deb85d1d2d
parentadd option to view calls to a method in general, not just the specific instan... (diff)
parentFix cursor and selection highlight color when using the dark theme (diff)
downloadenigma-d1e81ea5456b2fd5a8c3f5e3685bfdd4cac8a562.tar.gz
enigma-d1e81ea5456b2fd5a8c3f5e3685bfdd4cac8a562.tar.xz
enigma-d1e81ea5456b2fd5a8c3f5e3685bfdd4cac8a562.zip
Merge pull request #75 from shadowfacts/dracula-fixes
Fix cursor and selection highlight color when using the dark theme
-rw-r--r--src/main/java/cuchaz/enigma/config/Config.java8
-rw-r--r--src/main/java/cuchaz/enigma/gui/highlight/SelectionHighlightPainter.java4
-rw-r--r--src/main/java/cuchaz/enigma/gui/panels/PanelEditor.java6
3 files changed, 16 insertions, 2 deletions
diff --git a/src/main/java/cuchaz/enigma/config/Config.java b/src/main/java/cuchaz/enigma/config/Config.java
index 47bd0a7f..47b55066 100644
--- a/src/main/java/cuchaz/enigma/config/Config.java
+++ b/src/main/java/cuchaz/enigma/config/Config.java
@@ -64,6 +64,7 @@ public class Config {
64 public void apply(Config config) { 64 public void apply(Config config) {
65 switch (this) { 65 switch (this) {
66 case DEFAULT: 66 case DEFAULT:
67 //Defaults found here: https://github.com/Sciss/SyntaxPane/blob/122da367ff7a5d31627a70c62a48a9f0f4f85a0a/src/main/resources/de/sciss/syntaxpane/defaultsyntaxkit/config.properties#L139
67 config.lineNumbersForeground = 0x333300; 68 config.lineNumbersForeground = 0x333300;
68 config.lineNumbersBackground = 0xEEEEFF; 69 config.lineNumbersBackground = 0xEEEEFF;
69 config.lineNumbersSelected = 0xCCCCEE; 70 config.lineNumbersSelected = 0xCCCCEE;
@@ -76,6 +77,8 @@ public class Config {
76 config.otherColorOutline = new AlphaColorEntry(0xB4B4B4, 1.0f); 77 config.otherColorOutline = new AlphaColorEntry(0xB4B4B4, 1.0f);
77 config.editorBackground = 0xFFFFFF; 78 config.editorBackground = 0xFFFFFF;
78 config.highlightColor = 0x3333EE; 79 config.highlightColor = 0x3333EE;
80 config.caretColor = 0x000000;
81 config.selectionHighlightColor = 0x000000;
79 config.stringColor = 0xCC6600; 82 config.stringColor = 0xCC6600;
80 config.numberColor = 0x999933; 83 config.numberColor = 0x999933;
81 config.operatorColor = 0x000000; 84 config.operatorColor = 0x000000;
@@ -98,6 +101,8 @@ public class Config {
98 config.otherColorOutline = new AlphaColorEntry(0xB4B4B4, 0.0f); 101 config.otherColorOutline = new AlphaColorEntry(0xB4B4B4, 0.0f);
99 config.editorBackground = 0x282A36; 102 config.editorBackground = 0x282A36;
100 config.highlightColor = 0xFF79C6; 103 config.highlightColor = 0xFF79C6;
104 config.caretColor = 0xF8F8F2;
105 config.selectionHighlightColor = 0xF8F8F2;
101 config.stringColor = 0xF1FA8C; 106 config.stringColor = 0xF1FA8C;
102 config.numberColor = 0xBD93F9; 107 config.numberColor = 0xBD93F9;
103 config.operatorColor = 0xF8F8F2; 108 config.operatorColor = 0xF8F8F2;
@@ -125,9 +130,10 @@ public class Config {
125 public AlphaColorEntry deobfuscatedColorOutline; 130 public AlphaColorEntry deobfuscatedColorOutline;
126 public AlphaColorEntry otherColorOutline; 131 public AlphaColorEntry otherColorOutline;
127 132
128 //Defaults found here: https://github.com/Sciss/SyntaxPane/blob/122da367ff7a5d31627a70c62a48a9f0f4f85a0a/src/main/resources/de/sciss/syntaxpane/defaultsyntaxkit/config.properties#L139
129 public Integer editorBackground; 133 public Integer editorBackground;
130 public Integer highlightColor; 134 public Integer highlightColor;
135 public Integer caretColor;
136 public Integer selectionHighlightColor;
131 137
132 public Integer stringColor; 138 public Integer stringColor;
133 public Integer numberColor; 139 public Integer numberColor;
diff --git a/src/main/java/cuchaz/enigma/gui/highlight/SelectionHighlightPainter.java b/src/main/java/cuchaz/enigma/gui/highlight/SelectionHighlightPainter.java
index 5cbeabc0..81a70a92 100644
--- a/src/main/java/cuchaz/enigma/gui/highlight/SelectionHighlightPainter.java
+++ b/src/main/java/cuchaz/enigma/gui/highlight/SelectionHighlightPainter.java
@@ -11,6 +11,8 @@
11 11
12package cuchaz.enigma.gui.highlight; 12package cuchaz.enigma.gui.highlight;
13 13
14import cuchaz.enigma.config.Config;
15
14import javax.swing.text.Highlighter; 16import javax.swing.text.Highlighter;
15import javax.swing.text.JTextComponent; 17import javax.swing.text.JTextComponent;
16import java.awt.*; 18import java.awt.*;
@@ -22,7 +24,7 @@ public class SelectionHighlightPainter implements Highlighter.HighlightPainter {
22 // draw a thick border 24 // draw a thick border
23 Graphics2D g2d = (Graphics2D) g; 25 Graphics2D g2d = (Graphics2D) g;
24 Rectangle bounds = BoxHighlightPainter.getBounds(text, start, end); 26 Rectangle bounds = BoxHighlightPainter.getBounds(text, start, end);
25 g2d.setColor(Color.black); 27 g2d.setColor(new Color(Config.getInstance().selectionHighlightColor));
26 g2d.setStroke(new BasicStroke(2.0f)); 28 g2d.setStroke(new BasicStroke(2.0f));
27 g2d.drawRoundRect(bounds.x, bounds.y, bounds.width, bounds.height, 4, 4); 29 g2d.drawRoundRect(bounds.x, bounds.y, bounds.width, bounds.height, 4, 4);
28 } 30 }
diff --git a/src/main/java/cuchaz/enigma/gui/panels/PanelEditor.java b/src/main/java/cuchaz/enigma/gui/panels/PanelEditor.java
index ffceae12..9b016313 100644
--- a/src/main/java/cuchaz/enigma/gui/panels/PanelEditor.java
+++ b/src/main/java/cuchaz/enigma/gui/panels/PanelEditor.java
@@ -1,5 +1,6 @@
1package cuchaz.enigma.gui.panels; 1package cuchaz.enigma.gui.panels;
2 2
3import cuchaz.enigma.config.Config;
3import cuchaz.enigma.gui.BrowserCaret; 4import cuchaz.enigma.gui.BrowserCaret;
4import cuchaz.enigma.gui.Gui; 5import cuchaz.enigma.gui.Gui;
5 6
@@ -68,4 +69,9 @@ public class PanelEditor extends JEditorPane {
68 } 69 }
69 }); 70 });
70 } 71 }
72
73 @Override
74 public Color getCaretColor() {
75 return new Color(Config.getInstance().caretColor);
76 }
71} 77}