feat(settings): persist the theme through the settings binding

Keeps one writer for saved state: ui.setTheme() writes through
settings.setTheme() and then reloads the palette C cannot see.
This commit is contained in:
2026-08-04 20:44:13 -04:00
parent 9e58e72bf6
commit b3b5a9b2a3
9 changed files with 31 additions and 10 deletions
+12
View File
@@ -42,6 +42,18 @@ Status Settings::setTimezone(const std::string& timezone) {
: Status::failure("cannot save settings");
}
std::string Settings::theme() const { return settings.theme.c_str(); }
// Stores the name only. ui.setTheme() owns applying it, because the palette and
// the repaint it drives exist solely in Lua.
Status Settings::setTheme(const std::string& theme) {
if (theme.empty() || theme.size() > 16)
return Status::failure("theme must be 1 to 16 characters");
settings.theme = theme.c_str();
return settings.save() ? Status::success()
: Status::failure("cannot save settings");
}
int32_t Sys::millis() const { return static_cast<int32_t>(::millis()); }
esp32lua::MemoryInfo Sys::memory() const {