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:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user