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>
This commit is contained in:
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
SMALL_CLOCK_COLOR = 0x599f
NOTIFICATION_COLOR = 0x8fe0
ACCENT_MID = 0xf800
ACCENT_LO = 0x001f
ACCENT_HI = 0x07e0
SLIDER_DEFAULT_COLOR = 0x7777
BRIGHT = 0xffff
MID = 0xff00
UI = 0x39ff
SPOT1 = 0x00ff
SPOT2 = 0x44d0
CONTRAST = 7

View file

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

View file

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

View file

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

View file

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

View file

@ -102,5 +102,5 @@ class StepCounterApp():
t = str(count)
w = fonts.width(fonts.sans36, t)
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)

View file

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

View file

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

View file

@ -235,13 +235,13 @@ class Checkbox():
draw = wasp.watch.drawable
im = self._im
if self.state:
c1 = wasp.system.theme('slider-default')
c2 = draw.lighten(c1, 15)
c1 = wasp.system.theme('ui')
c2 = draw.lighten(c1, wasp.system.theme('contrast'))
fg = c2
else:
c1 = 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 at the natural location
x = 239 - 32 - 4 if im[2] else im[0]
@ -283,10 +283,10 @@ class Slider():
y = self._y
color = self._color
if self._color is None:
self._color = wasp.system.theme('slider-default')
self._color = wasp.system.theme('ui')
color = self._color
if self._lowlight is None:
self._lowlight = draw.lighten(color, 15)
self._lowlight = draw.lighten(color, wasp.system.theme('contrast'))
light = self._lowlight
knob_x = x + ((_SLIDER_TRACK * self.value) // (self._steps-1))
@ -344,7 +344,7 @@ class Spinner():
"""Draw the slider."""
draw = watch.drawable
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.down_arrow, im[0]+30-8, im[1]+120-20-9, fg)
self.update()