feat(settings): persist the theme through the settings binding
The palette lives in Lua, so C++ stores the name only and ui.setTheme() writes through here before rebuilding and repainting.
This commit is contained in:
+12
-1
@@ -17,6 +17,17 @@ fs = {
|
||||
end,
|
||||
}
|
||||
|
||||
local savedTheme = "light"
|
||||
settings = {
|
||||
getTheme = function()
|
||||
return savedTheme
|
||||
end,
|
||||
setTheme = function(name)
|
||||
savedTheme = name
|
||||
return true
|
||||
end,
|
||||
}
|
||||
|
||||
local frameWidth, frameHeight = 320, 480
|
||||
|
||||
gui = {
|
||||
@@ -166,7 +177,7 @@ assert(table.concat(ui.themeNames(), ",") == "dark,light,mono")
|
||||
local ok, err = ui.setTheme "missing"
|
||||
assert(ok == nil and err == "Unknown theme")
|
||||
assert(ui.setTheme "dark" == true)
|
||||
assert(files["/.lua/theme"] == "dark" and ui.getTheme() == "dark")
|
||||
assert(savedTheme == "dark" and ui.getTheme() == "dark")
|
||||
|
||||
local events = {}
|
||||
local function handler(name)
|
||||
|
||||
Reference in New Issue
Block a user