1
0
Fork 0

manager: Recategorize the theme labels for apps

By default bright and mid are white/grey tones, the ui widgets are
blue and the spot colours are different variants of orange.

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
pull/127/head
Daniel Thompson 2020-12-31 19:12:38 +00:00
parent 1eada36ff4
commit ad9714b0dc
9 changed files with 49 additions and 39 deletions

View File

@ -9,7 +9,9 @@ class Theme(DefaultTheme):
BATTERY_COLOR = 0x07ff BATTERY_COLOR = 0x07ff
SMALL_CLOCK_COLOR = 0x599f SMALL_CLOCK_COLOR = 0x599f
NOTIFICATION_COLOR = 0x8fe0 NOTIFICATION_COLOR = 0x8fe0
ACCENT_MID = 0xf800 BRIGHT = 0xffff
ACCENT_LO = 0x001f MID = 0xff00
ACCENT_HI = 0x07e0 UI = 0x39ff
SLIDER_DEFAULT_COLOR = 0x7777 SPOT1 = 0x00ff
SPOT2 = 0x44d0
CONTRAST = 7

View File

@ -17,10 +17,12 @@ class DefaultTheme():
BATTERY_COLOR = 0x7bef BATTERY_COLOR = 0x7bef
SMALL_CLOCK_COLOR = 0xe73c SMALL_CLOCK_COLOR = 0xe73c
NOTIFICATION_COLOR = 0x7bef NOTIFICATION_COLOR = 0x7bef
ACCENT_MID = 0xb5b6 BRIGHT = 0xffff
ACCENT_LO = 0xbdb6 MID = 0xbdb6
ACCENT_HI = 0xffff UI = 0x39ff
SLIDER_DEFAULT_COLOR = 0x39ff SPOT1 = 0xff00
SPOT2 = 0xddd0
CONTRAST = 15
def serialize(self) -> bytes: def serialize(self) -> bytes:
"""Serializes the theme for use in wasp-os""" """Serializes the theme for use in wasp-os"""
@ -32,10 +34,12 @@ class DefaultTheme():
*split_bytes(self.BATTERY_COLOR), *split_bytes(self.BATTERY_COLOR),
*split_bytes(self.SMALL_CLOCK_COLOR), *split_bytes(self.SMALL_CLOCK_COLOR),
*split_bytes(self.NOTIFICATION_COLOR), *split_bytes(self.NOTIFICATION_COLOR),
*split_bytes(self.ACCENT_MID), *split_bytes(self.BRIGHT),
*split_bytes(self.ACCENT_LO), *split_bytes(self.MID),
*split_bytes(self.ACCENT_HI), *split_bytes(self.UI),
*split_bytes(self.SLIDER_DEFAULT_COLOR), *split_bytes(self.SPOT1),
*split_bytes(self.SPOT2),
*split_bytes(self.CONTRAST)
]) ])
return theme_bytes return theme_bytes

View File

@ -58,9 +58,8 @@ class ChronoApp():
True then a full redraw is be performed. True then a full redraw is be performed.
""" """
draw = wasp.watch.drawable draw = wasp.watch.drawable
hi = wasp.system.theme('accent-hi') hi = wasp.system.theme('bright')
mid = wasp.system.theme('accent-mid') c1 = draw.darken(wasp.system.theme('spot1'), wasp.system.theme('contrast'))
lo = wasp.system.theme('accent-lo')
if redraw: if redraw:
now = wasp.watch.rtc.get_localtime() now = wasp.watch.rtc.get_localtime()
@ -72,7 +71,7 @@ class ChronoApp():
wasp.system.bar.draw() wasp.system.bar.draw()
# Draw the dividers # Draw the dividers
draw.set_color(mid) draw.set_color(wasp.system.theme('mid'))
for theta in range(12): for theta in range(12):
draw.polar(120, 120, theta * 360 // 12, 110, 118, 3) draw.polar(120, 120, theta * 360 // 12, 110, 118, 3)
@ -98,5 +97,5 @@ class ChronoApp():
hh = (30 * (self._hh % 12)) + (self._mm / 2) hh = (30 * (self._hh % 12)) + (self._mm / 2)
mm = 6 * self._mm mm = 6 * self._mm
draw.polar(120, 120, hh, 5, 75, 7, hi) draw.polar(120, 120, hh, 5, 75, 7, hi)
draw.polar(120, 120, hh, 5, 60, 3, lo) draw.polar(120, 120, hh, 5, 60, 3, draw.darken(c1, 2))
draw.polar(120, 120, mm, 5, 106, 5, hi) draw.polar(120, 120, mm, 5, 106, 5, hi)

View File

@ -70,9 +70,9 @@ class ClockApp():
True then a full redraw is be performed. True then a full redraw is be performed.
""" """
draw = wasp.watch.drawable draw = wasp.watch.drawable
hi = wasp.system.theme('accent-hi') hi = wasp.system.theme('bright')
mid = wasp.system.theme('accent-mid') lo = wasp.system.theme('mid')
lo = wasp.system.theme('accent-lo') mid = draw.lighten(lo, 1)
if redraw: if redraw:
now = wasp.watch.rtc.get_localtime() now = wasp.watch.rtc.get_localtime()

View File

@ -45,7 +45,7 @@ class HeartApp():
0, 6, width=240) 0, 6, width=240)
# Graph is orange by default... # Graph is orange by default...
color = 0xffc0 color = wasp.system.theme('spot1')
# If the maths goes wrong lets show it in the chart! # If the maths goes wrong lets show it in the chart!
if spl > 100 or spl < -100: if spl > 100 or spl < -100:

View File

@ -102,5 +102,5 @@ class StepCounterApp():
t = str(count) t = str(count)
w = fonts.width(fonts.sans36, t) w = fonts.width(fonts.sans36, t)
draw.set_font(fonts.sans36) draw.set_font(fonts.sans36)
draw.set_color(0xfff0) draw.set_color(draw.lighten(wasp.system.theme('spot1'), wasp.system.theme('contrast')))
draw.string(t, 228-w, 132-18) draw.string(t, 228-w, 132-18)

View File

@ -88,6 +88,9 @@ class StopwatchApp():
return return
y = 240 - 6 - (len(splits) * 24) y = 240 - 6 - (len(splits) * 24)
draw.set_font(fonts.sans24)
draw.set_color(wasp.system.theme('mid'))
n = self._nsplits n = self._nsplits
for i, s in enumerate(splits): for i, s in enumerate(splits):
centisecs = s centisecs = s
@ -99,8 +102,6 @@ class StopwatchApp():
t = '# {} {:02}:{:02}.{:02}'.format(n, minutes, secs, centisecs) t = '# {} {:02}:{:02}.{:02}'.format(n, minutes, secs, centisecs)
n -= 1 n -= 1
draw.set_font(fonts.sans24)
draw.set_color(0xe73c)
w = fonts.width(fonts.sans24, t) w = fonts.width(fonts.sans24, t)
draw.string(t, 0, y + (i*24), 240) draw.string(t, 0, y + (i*24), 240)
@ -139,7 +140,7 @@ class StopwatchApp():
draw = wasp.watch.drawable draw = wasp.watch.drawable
draw.set_font(fonts.sans36) draw.set_font(fonts.sans36)
draw.set_color(0xc67f) draw.set_color(draw.lighten(wasp.system.theme('ui'), wasp.system.theme('contrast')))
w = fonts.width(fonts.sans36, t1) w = fonts.width(fonts.sans36, t1)
draw.string(t1, 180-w, 120-36) draw.string(t1, 180-w, 120-36)
draw.fill(0, 0, 120-36, 180-w, 36) draw.fill(0, 0, 120-36, 180-w, 36)

View File

@ -123,10 +123,12 @@ class Manager():
b'\x7b\xef' # battery b'\x7b\xef' # battery
b'\xe7\x3c' # status-clock b'\xe7\x3c' # status-clock
b'\x7b\xef' # notify-icon b'\x7b\xef' # notify-icon
b'\xb5\xb6' # accent-mid b'\xff\xff' # bright
b'\xbd\xb6' # accent-lo b'\xbd\xb6' # mid
b'\xff\xff' # accent-hi b'\x39\xff' # ui
b'\x39\xff' # slider-default b'\xff\x00' # spot1
b'\xdd\xd0' # spot2
b'\x00\x0f' # contrast
) )
self.blank_after = 15 self.blank_after = 15
@ -542,10 +544,12 @@ class Manager():
"battery", "battery",
"status-clock", "status-clock",
"notify-icon", "notify-icon",
"accent-mid", "bright",
"accent-lo", "mid",
"accent-hi", "ui",
"slider-default") "spot1",
"spot2",
"contrast")
if theme_part not in theme_parts: if theme_part not in theme_parts:
raise IndexError('Theme part {} does not exist'.format(theme_part)) raise IndexError('Theme part {} does not exist'.format(theme_part))
idx = theme_parts.index(theme_part) * 2 idx = theme_parts.index(theme_part) * 2

View File

@ -235,13 +235,13 @@ class Checkbox():
draw = wasp.watch.drawable draw = wasp.watch.drawable
im = self._im im = self._im
if self.state: if self.state:
c1 = wasp.system.theme('slider-default') c1 = wasp.system.theme('ui')
c2 = draw.lighten(c1, 15) c2 = draw.lighten(c1, wasp.system.theme('contrast'))
fg = c2 fg = c2
else: else:
c1 = 0 c1 = 0
c2 = 0 c2 = 0
fg = wasp.system.theme('accent-lo') fg = wasp.system.theme('mid')
# Draw checkbox on the right margin if there is a label, otherwise # Draw checkbox on the right margin if there is a label, otherwise
# draw at the natural location # draw at the natural location
x = 239 - 32 - 4 if im[2] else im[0] x = 239 - 32 - 4 if im[2] else im[0]
@ -283,10 +283,10 @@ class Slider():
y = self._y y = self._y
color = self._color color = self._color
if self._color is None: if self._color is None:
self._color = wasp.system.theme('slider-default') self._color = wasp.system.theme('ui')
color = self._color color = self._color
if self._lowlight is None: if self._lowlight is None:
self._lowlight = draw.lighten(color, 15) self._lowlight = draw.lighten(color, wasp.system.theme('contrast'))
light = self._lowlight light = self._lowlight
knob_x = x + ((_SLIDER_TRACK * self.value) // (self._steps-1)) knob_x = x + ((_SLIDER_TRACK * self.value) // (self._steps-1))
@ -344,7 +344,7 @@ class Spinner():
"""Draw the slider.""" """Draw the slider."""
draw = watch.drawable draw = watch.drawable
im = self._im im = self._im
fg = draw.lighten(wasp.system.theme('slider-default'), 15) fg = draw.lighten(wasp.system.theme('ui'), wasp.system.theme('contrast'))
draw.blit(icons.up_arrow, im[0]+30-8, im[1]+20, fg) draw.blit(icons.up_arrow, im[0]+30-8, im[1]+20, fg)
draw.blit(icons.down_arrow, im[0]+30-8, im[1]+120-20-9, fg) draw.blit(icons.down_arrow, im[0]+30-8, im[1]+120-20-9, fg)
self.update() self.update()