Skip to content

Commit 9a3881e

Browse files
author
duff2013
committed
set grid color through theme.txt now
1 parent db8526c commit 9a3881e

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

app/src/processing/app/SerialPlotter.java

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,13 @@ private class GraphPanel extends JPanel {
7575
private Rectangle bounds;
7676
private int xOffset, xPadding;
7777
private final Font font;
78-
private final Color bgColor;
79-
private final Color gridColor = new Color(245, 245, 245, 245);
78+
private final Color bgColor, gridColor, boundsColor;
8079

8180
public GraphPanel() {
8281
font = Theme.getFont("console.font");
8382
bgColor = Theme.getColor("plotting.bgcolor");
83+
gridColor = Theme.getColor("plotting.gridcolor");
84+
boundsColor = Theme.getColor("plotting.boundscolor");
8485
xOffset = 20;
8586
xPadding = 20;
8687
}
@@ -134,7 +135,7 @@ public void paintComponent(Graphics g1) {
134135
Rectangle2D fRect = fm.getStringBounds(String.valueOf(tick), g);
135136
xOffset = Math.max(xOffset, (int) fRect.getWidth() + 15);
136137

137-
g.setColor(Color.BLACK);
138+
g.setColor(boundsColor);
138139
// draw tick
139140
g.drawLine(xOffset - 5, (int) transformY(tick), xOffset + 2, (int) transformY(tick));
140141
// draw tick label
@@ -144,8 +145,6 @@ public void paintComponent(Graphics g1) {
144145
g.drawLine(xOffset + 3, (int) transformY(tick), bounds.width - xPadding, (int) transformY(tick));
145146
}
146147

147-
//g.drawLine(bounds.x + xOffset, bounds.y + 5, bounds.x + xOffset, bounds.y + bounds.height - 10);
148-
149148
// handle data count
150149
int cnt = xCount - BUFFER_CAPACITY;
151150
if (xCount < BUFFER_CAPACITY) cnt = 0;
@@ -170,15 +169,15 @@ public void paintComponent(Graphics g1) {
170169
sWidth = (int)fBounds.getWidth()/2;
171170
xValue = (int)((bounds.width - xOffset - xPadding) * ((xTickRange * i) / BUFFER_CAPACITY) + xOffset);
172171
}
173-
// draw graph x axis ticks and labels
174-
g.setColor(Color.BLACK);
172+
// draw graph x axis, ticks and labels
173+
g.setColor(boundsColor);
175174
g.drawString(s, xValue - sWidth, (int) bounds.y + (int) transformY(zeroTick) + 15);
176175
g.drawLine(xValue, (int)transformY(zeroTick) - 2, xValue, bounds.y + (int)transformY(zeroTick) + 5);
177176
// draw vertical grid lines
178177
g.setColor(gridColor);
179178
g.drawLine(xValue, (int)transformY(zeroTick) - 3, xValue, bounds.y + (int)transformY(lastTick));
180179
}
181-
g.setColor(Color.BLACK);
180+
g.setColor(boundsColor);
182181
// draw major y axis
183182
g.drawLine(bounds.x + xOffset, (int) transformY(lastTick) - 5, bounds.x + xOffset, bounds.y + (int) transformY(zeroTick) + 5);
184183
// draw major x axis

build/shared/lib/theme/theme.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ buttons.status.color = #ffffff
4040
# color cycle created via colorbrewer2.org
4141
plotting.bgcolor = #ffffff
4242
plotting.color = #ffffff
43+
plotting.gridcolor = #f0f0f0
44+
plotting.boundscolor = #000000
4345
plotting.graphcolor.size = 4
4446
plotting.graphcolor.00 = #2c7bb6
4547
plotting.graphcolor.01 = #fdae61

0 commit comments

Comments
 (0)