mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-11-02 19:02:00 +00:00
feat(l2): light theme
Settings > Display > Theme: Dark / Light (NVS mc_ui/light). The colour tokens are set once before anything is built, so a change restarts the device. Text on an accent fill is the new ON_ACCENT (it was BG, white in the light theme); each accent has a deeper hand-picked light variant that reads on white and takes white text. The map's empty-tile fill and grid and the areas' outlines follow the theme too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -127,6 +127,14 @@ void UITask::setBrightnessPct(uint8_t pct, bool save) {
|
||||
if (save) prefsSave();
|
||||
}
|
||||
|
||||
// Every screen is built in the theme's colours: a new one starts afresh.
|
||||
static void onThemeChoice(lv_event_t* e) {
|
||||
const bool light = choiceSelected((lv_obj_t*)lv_event_get_target(e)) == 1;
|
||||
if (light == theme::s_light) return;
|
||||
lvport::saveLight(light);
|
||||
restartScreen(light ? "Starting in the light theme." : "Starting in the dark theme.");
|
||||
}
|
||||
|
||||
static void onTapWake(lv_event_t* e) {
|
||||
s_ui->setTapWake(lv_obj_has_state((lv_obj_t*)lv_event_get_target(e), LV_STATE_CHECKED));
|
||||
}
|
||||
@@ -158,7 +166,9 @@ void UITask::buildSchemaSettings() {
|
||||
g = group(body, "LOCK");
|
||||
schemaRow(g, SETTING(auto_lock));
|
||||
listRow(g, "Screen PIN", pinSet() ? "On - asked when the screen wakes" : "Off", onPinSetup, NULL);
|
||||
accentRow(group(body, "LOOK")); // DeviceScreen.h
|
||||
g = group(body, "LOOK");
|
||||
choiceRow(g, "Theme", "Changing it restarts the device", "Dark\nLight", theme::s_light ? 1 : 0, onThemeChoice);
|
||||
accentRow(g); // DeviceScreen.h
|
||||
return;
|
||||
}
|
||||
case PG_POWER: {
|
||||
|
||||
Reference in New Issue
Block a user