summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Thompson <daniel@redfelineninja.org.uk>2020-12-31 19:14:33 (GMT)
committerDaniel Thompson <daniel@redfelineninja.org.uk>2020-12-31 19:26:34 (GMT)
commit71069e0170d22e60125d149630416e9dab7042a5 (patch)
treed33543dab284b0bccbefe9b39a009442d26df9a8
parentad9714b0dc2f2053d3d31a8cd013d456fefdc93d (diff)
apps: calc: Use the UI colours to generate a background
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
-rw-r--r--wasp/apps/calc.py33
1 files changed, 23 insertions, 10 deletions
diff --git a/wasp/apps/calc.py b/wasp/apps/calc.py
index 520ac46..1268a26 100644
--- a/wasp/apps/calc.py
+++ b/wasp/apps/calc.py
@@ -84,30 +84,43 @@ class CalculatorApp():
def _draw(self):
draw = wasp.watch.drawable
- draw.fill()
+
+ hi = wasp.system.theme('bright')
+ lo = wasp.system.theme('mid')
+ mid = draw.lighten(lo, 2)
+ bg = draw.darken(wasp.system.theme('ui'), wasp.system.theme('contrast'))
+ bg2 = draw.darken(bg, 2)
+
+ # Draw the background
+ draw.fill(0, 0, 0, 239, 47)
+ draw.fill(0, 236, 239, 3)
+ draw.fill(bg, 141, 48, 239-141, 235-48)
+ draw.fill(bg2, 0, 48, 140, 235-48)
+
# Make grid:
- draw.set_color(wasp.system.theme('accent-lo'))
+ draw.set_color(lo)
for i in range(4):
# horizontal lines
draw.line(x0=0,y0=(i+1)*47,x1=239,y1=(i+1)*47)
# vertical lines
- draw.line(x0=(i+1)*47,y0=47,x1=(i+1)*47,y1=239)
- draw.line(x0=0, y0=47, x1=0, y1=239)
- draw.line(x0=239, y0=47, x1=239, y1=239)
- draw.line(x0=0, y0=239, x1=239, y1=239)
- # Draw button label:
- draw.set_color(wasp.system.theme('accent-hi'))
+ draw.line(x0=(i+1)*47,y0=47,x1=(i+1)*47,y1=235)
+ draw.line(x0=0, y0=47, x1=0, y1=236)
+ draw.line(x0=239, y0=47, x1=239, y1=236)
+ draw.line(x0=0, y0=236, x1=239, y1=236)
+
+ # Draw button labels
+ draw.set_color(hi, bg2)
for x in range(5):
if x == 3:
- draw.set_color(wasp.system.theme('accent-mid'))
+ draw.set_color(mid, bg)
for y in range(4):
label = fields[x + 5*y]
if (x == 0):
draw.string(label, x*47+14, y*47+60)
else:
draw.string(label, x*47+16, y*47+60)
+ draw.set_color(hi)
draw.string("<", 215, 10)
- draw.set_color(wasp.system.theme('accent-hi'))
def _update(self):
output = self.output if len(self.output) < 12 else self.output[len(self.output)-12:]