wasp-os/tools/test_theme.py
kozova1 2624a6e998 Added basic theming engine.
This theming engine uses a bytestring (but supports anything indexable,
as long as the index results are a byte long),
stored as `wasp.system._theme`.
It has a default value, which should not change anything about the way this looks currently.

The theme can be set via `wasp.system.set_theme`,
but this should *ONLY* be used in `main.py`.
`wasp.system.set_theme` will return True if it was successful,
or False if the theme is of an old format.
Using an old format theme will *not* crash the watch,
but will use the default theme instead.

To theme this, one has to use tools/themer.py (use flag -h for complete explanation)
to generate a bytestring that's added in main.py (see diff).

The bytestring is then loaded into 'wasp.system._theme'.
Theme values can be looked up by apps by using `wasp.system.theme("theme-key")`.
Theme keys appear in the function body of `wasp.system.theme()`.

I've took the liberty of converting existing apps to use this method,
and it seems to work well.

A test theme is provided in `tools/test_theme.py`

Signed-off-by: kozova1 <mug66kk@gmail.com>
2020-12-13 16:51:07 +00:00

16 lines
551 B
Python

from themer import DefaultTheme
class Theme(DefaultTheme):
# These colors were chosen specifically because they're hard to miss.
# Using this theme on an actual device is not advised
# The default theme was generated by removing all the lines below and adding `pass` instead.
BLE_COLOR = 0xfb80
SCROLL_INDICATOR_COLOR = 0xf800
BATTERY_CHARGING_COLOR = 0x07ff
SMALL_CLOCK_COLOR = 0x599f
NOTIFICATION_COLOR = 0x8fe0
ACCENT_MID = 0xf800
ACCENT_LO = 0x001f
ACCENT_HI = 0x07e0
SLIDER_DEFAULT_COLOR = 0x7777