diff options
| author | ailurux <ailuruxx@gmail.com> | 2024-08-12 03:19:03 +0000 |
|---|---|---|
| committer | cooljqln <cooljqln@noreply.codeberg.org> | 2024-08-12 03:19:03 +0000 |
| commit | d719f9c5017ad8006c21b6d546a5d70e846e9502 (patch) | |
| tree | 0da75c201e98d12b39c87743ee3ed242d2fc5809 /lua/main.lua | |
| parent | 3d7b005dc98235899d1a9ae5a74bf11d916028b9 (diff) | |
| download | tangara-fw-d719f9c5017ad8006c21b6d546a5d70e846e9502.tar.gz | |
daniel/theme-setting (#87)
- Themes can be loaded from disk and built-in
- Themes can be selected in a new themes menu of the settings screen
- Some touch-ups to existing themes
- The saved theme is persisted in nvs
Reviewed-on: https://codeberg.org/cool-tech-zone/tangara-fw/pulls/87
Reviewed-by: cooljqln <cooljqln@noreply.codeberg.org>
Co-authored-by: ailurux <ailuruxx@gmail.com>
Co-committed-by: ailurux <ailuruxx@gmail.com>
Diffstat (limited to 'lua/main.lua')
| -rw-r--r-- | lua/main.lua | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/lua/main.lua b/lua/main.lua index 4cd754b6..9dd88c84 100644 --- a/lua/main.lua +++ b/lua/main.lua @@ -14,9 +14,15 @@ local backstack = require("backstack") local main_menu = require("main_menu") local function init_ui() - -- Load the theme within init_ui because the theme needs fonts to be ready. - local theme_dark = require("theme_dark") - theme.set(theme_dark) + -- Theme is set within init_ui because the theme needs fonts to be ready. + -- Set the theme to the saved theme if available + local saved_theme = theme.theme_filename() + local res = theme.load_theme(saved_theme) + if not res then + -- Set a default theme (in case the saved theme does not load) + local default_theme = require("theme_light") + theme.set(default_theme) + end local lock_time = time.ticks() |
