-
Notifications
You must be signed in to change notification settings - Fork 89
Expand file tree
/
Copy pathTheme.java
More file actions
260 lines (215 loc) · 10.1 KB
/
Theme.java
File metadata and controls
260 lines (215 loc) · 10.1 KB
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
package nodebox.client;
import javax.swing.*;
import javax.swing.border.Border;
import java.awt.*;
public class Theme {
// Default colors
public static final Color DEFAULT_ARROW_COLOR = new Color(136, 136, 136);
public static final Color DEFAULT_SHADOW_COLOR = new Color(176, 176, 176);
public static final Color DEFAULT_SPLIT_COLOR = new Color(139, 139, 139);
// Viewer
public static final Color VIEWER_BACKGROUND_COLOR = new Color(232, 232, 232);
// Network view
public static final Color NETWORK_BACKGROUND_COLOR = new Color(69, 69, 69);
public static final Color NETWORK_SELECTION_COLOR = new Color(200, 200, 200, 100);
public static final Color NETWORK_SELECTION_BORDER_COLOR = new Color(100, 100, 100, 100);
public static final Color NETWORK_NODE_NAME_COLOR = new Color(194, 194, 194);
public static final Color NETWORK_NODE_NAME_SHADOW_COLOR = new Color(23, 23, 23);
public static final Color CONNECTION_DEFAULT_COLOR = new Color(100, 100, 100);
public static final Color CONNECTION_CONNECTING_COLOR = new Color(170, 167, 18);
public static final Color CONNECTION_ACTION_COLOR = new Color(0, 116, 168);
// Parameter view
public static final Color PARAMETER_EXPRESSION_BACKGROUND_COLOR = new Color(255, 255, 220);
public static final Color PARAMETER_LABEL_BACKGROUND = new Color(153, 153, 153);
public static final Color PARAMETER_VALUE_BACKGROUND = new Color(196, 196, 196);
public static final Color DRAGGABLE_NUMBER_HIGHLIGHT_COLOR = new Color(223, 223, 223);
// Source editor
public static final Color MESSAGES_BACKGROUND_COLOR = new Color(240, 240, 240);
public static final Color EDITOR_SPLITTER_DIVIDER_COLOR = new Color(210, 210, 210);
public static final Color EDITOR_DISABLED_BACKGROUND_COLOR = new Color(240, 240, 240);
// Expression editor
public static final Color EXPRESSION_ERROR_BACKGROUND_COLOR = new Color(240, 240, 240);
public static final Color EXPRESSION_ERROR_FOREGROUND_COLOR = new Color(200, 0, 0);
// Node attributes editor
public static final Color NODE_ATTRIBUTES_PARAMETER_LIST_BACKGROUND_COLOR = new Color(240, 240, 250);
public static final Color NODE_ATTRIBUTES_PARAMETER_COLOR = new Color(60, 60, 60);
// Node selection dialog
public static final Color NODE_SELECTION_BACKGROUND_COLOR = new Color(244, 244, 244);
public static final Color NODE_SELECTION_ACTIVE_BACKGROUND_COLOR = new Color(224, 224, 224);
// Text
public static final Color TEXT_NORMAL_COLOR = new Color(60, 60, 60);
public static final Color TEXT_ARMED_COLOR = new Color(0, 0, 0);
public static final Color TEXT_SHADOW_COLOR = new Color(255, 255, 255);
public static final Color TEXT_DISABLED_COLOR = new Color(98, 112, 130);
public static final Color TEXT_HEADER_COLOR = new Color(93, 93, 93);
public static final Color TEXT_WARNING_COLOR = new Color(200, 0, 0);
// Borders
public static Border LINE_BORDER;
public static Border TOP_BOTTOM_BORDER;
public static Border BOTTOM_BORDER;
public static Border PARAMETER_ROW_BORDER;
public static Border PARAMETER_NOTES_BORDER;
// Fonts
public static Font EDITOR_FONT;
public static Font MESSAGE_FONT;
public static Font INFO_FONT;
public static Font SMALL_FONT;
public static Font SMALL_BOLD_FONT;
public static Font SMALL_MONO_FONT;
static {
// Intialize borders.
Color borderColor;
if (PlatformUtils.onWindows()) {
borderColor = new Color(100, 100, 100);
} else if (PlatformUtils.onMac()) {
borderColor = new Color(200, 200, 200);
} else {
borderColor = new Color(200, 200, 200);
}
LINE_BORDER = BorderFactory.createLineBorder(borderColor);
Color topColor = new Color(224, 224, 224);
Color bottomColor = new Color(245, 245, 245);
TOP_BOTTOM_BORDER = new TopBottomBorder(topColor, bottomColor);
Color whiteColor = new Color(255, 255, 255);
BOTTOM_BORDER = new BottomBorder(whiteColor);
PARAMETER_ROW_BORDER = new RowBorder();
PARAMETER_NOTES_BORDER = new NotesBorder();
// Initialize fonts.
if (PlatformUtils.onMac()) {
EDITOR_FONT = new Font("Monaco", Font.PLAIN, 11);
MESSAGE_FONT = new Font("Lucida Grande", Font.BOLD, 13);
INFO_FONT = new Font("Lucida Grande", Font.PLAIN, 11);
SMALL_FONT = new Font("Lucida Grande", Font.PLAIN, 11);
SMALL_BOLD_FONT = new Font("Lucida Grande", Font.BOLD, 11);
SMALL_MONO_FONT = new Font("Monaco", Font.PLAIN, 10);
} else {
EDITOR_FONT = new Font(Font.MONOSPACED, Font.PLAIN, 11);
MESSAGE_FONT = new Font("Verdana", Font.BOLD, 11);
INFO_FONT = new Font("Verdana", Font.PLAIN, 10);
SMALL_FONT = new Font("Verdana", Font.PLAIN, 10);
SMALL_BOLD_FONT = new Font("Verdana", Font.BOLD, 10);
SMALL_MONO_FONT = new Font(Font.MONOSPACED, Font.PLAIN, 10);
}
}
public static class ArrowIcon implements Icon {
public void paintIcon(Component c, Graphics g, int x, int y) {
g.setColor(Theme.DEFAULT_ARROW_COLOR);
g.drawLine(x + 1, y, x + 1, y);
g.drawLine(x + 1, y + 1, x + 2, y + 1);
g.drawLine(x + 1, y + 2, x + 3, y + 2);
g.drawLine(x + 1, y + 3, x + 4, y + 3);
g.drawLine(x + 1, y + 4, x + 3, y + 4);
g.drawLine(x + 1, y + 5, x + 2, y + 5);
g.drawLine(x + 1, y + 6, x + 1, y + 6);
}
public int getIconWidth() {
return 6;
}
public int getIconHeight() {
return 8;
}
}
public static class TopBottomBorder implements Border {
private Color topColor;
private Color bottomColor;
public TopBottomBorder(Color topColor, Color bottomColor) {
this.topColor = topColor;
this.bottomColor = bottomColor;
}
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
g.setColor(topColor);
g.drawLine(x, y, x + width, y);
g.setColor(bottomColor);
g.drawLine(x, y + height - 1, x + width, y + height - 1);
}
public Insets getBorderInsets(Component c) {
return new Insets(1, 0, 1, 0);
}
public boolean isBorderOpaque() {
return true;
}
}
public static class BottomBorder implements Border {
private Color bottomColor;
public BottomBorder(Color bottomColor) {
this.bottomColor = bottomColor;
}
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
g.setColor(bottomColor);
g.drawLine(x, y + height - 1, x + width, y + height - 1);
}
public Insets getBorderInsets(Component c) {
return new Insets(0, 0, 1, 0);
}
public boolean isBorderOpaque() {
return true;
}
}
public static class RowBorder implements Border {
private static final Color LABEL_UP_COLOR = new Color(140, 140, 140);
private static final Color LABEL_DOWN_COLOR = new Color(166, 166, 166);
private static final Color PARAMETER_UP_COLOR = new Color(179, 179, 179);
private static final Color PARAMETER_DOWN_COLOR = new Color(213, 213, 213);
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
int labelWidth = ParameterView.LABEL_WIDTH;
// Draw border on the side of the label
g.setColor(LABEL_UP_COLOR);
g.fillRect(x, y + height - 2, labelWidth - 2, 1);
g.setColor(LABEL_DOWN_COLOR);
g.fillRect(x, y + height - 1, labelWidth - 2, 1);
// Draw border on parameter side
g.setColor(PARAMETER_UP_COLOR);
g.fillRect(x + labelWidth + 1, y + height - 2, width - labelWidth - 1, 1);
g.setColor(PARAMETER_DOWN_COLOR);
g.fillRect(x + labelWidth + 1, y + height - 1, width - labelWidth - 1, 1);
}
public Insets getBorderInsets(Component c) {
return new Insets(4, 0, 4, 0);
}
public boolean isBorderOpaque() {
return true;
}
}
public static class NotesBorder implements Border {
private static final Color LABEL_UP_COLOR = new Color(140, 140, 140);
private static final Color LABEL_DOWN_COLOR = new Color(166, 166, 166);
private static final Color PARAMETER_UP_COLOR = new Color(150, 154, 43);
private static final Color PARAMETER_DOWN_COLOR = new Color(213, 213, 213);
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
int labelWidth = ParameterView.LABEL_WIDTH;
// Draw border on the side of the label
g.setColor(LABEL_UP_COLOR);
g.fillRect(x, y + height - 2, labelWidth - 2, 1);
g.setColor(LABEL_DOWN_COLOR);
g.fillRect(x, y + height - 1, labelWidth - 2, 1);
// Draw border on parameter side
g.setColor(PARAMETER_UP_COLOR);
g.fillRect(x + labelWidth, y + height - 2, width - labelWidth, 1);
g.setColor(PARAMETER_DOWN_COLOR);
g.fillRect(x + labelWidth + 1, y + height - 1, width - labelWidth - 1, 1);
}
public Insets getBorderInsets(Component c) {
return new Insets(4, 0, 4, 0);
}
public boolean isBorderOpaque() {
return true;
}
}
public static class InsetsBorder implements Border {
private Insets insets;
public InsetsBorder(Insets insets) {
this.insets = insets;
}
public InsetsBorder(int x, int y, int width, int height) {
this.insets = new Insets(x, y, width, height);
}
public void paintBorder(Component component, Graphics graphics, int i, int i1, int i2, int i3) {
}
public Insets getBorderInsets(Component component) {
return insets;
}
public boolean isBorderOpaque() {
return true;
}
}
}