lcd.themeColor¶
since 1.1.0
Get / Set the theme color.
Parameters¶
| Name | Type | Required | Description |
|---|---|---|---|
index |
integer | yes | theme color index |
color |
integer | optional | color value |
Returns¶
color (integer)
Examples¶
local function paint(widget)
local w, h = lcd.getWindowSize()
lcd.color(lcd.themeColor(THEME_DEFAULT_BGCOLOR))
lcd.drawFilledRectangle(0, 0, w, h)
lcd.color(lcd.themeColor(THEME_DEFAULT_COLOR))
lcd.drawText(4, 4, widget.label)
lcd.color(lcd.themeColor(THEME_WARNING_COLOR))
lcd.drawText(4, 30, "Low battery")
end
Using theme colors keeps a script readable on light and dark themes. All indexes are listed under Theme colors.
Used in¶
Real-world usage¶
Called 10 times across 3 open-source Ethos Lua projects. A few short excerpts: