From 3ae331a2b5aa4d9f50b37546c4b60c8994497b0a Mon Sep 17 00:00:00 2001 From: friedkeenan Date: Mon, 10 Sep 2018 20:13:50 -0500 Subject: [PATCH] Fixed formatting and added default case The default case acts like the system theme is the dark one, because who really use the light theme? --- README.md | 1 - common/theme.c | 10 +++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 4e6c2bf..df706f2 100644 --- a/README.md +++ b/README.md @@ -11,4 +11,3 @@ Build with ```make nx``` or just run ```make```. * This uses code based on 3DS [new-hbmenu](https://github.com/fincs/new-hbmenu). * [nanojpeg](https://svn.emphy.de/nanojpeg/trunk/nanojpeg/nanojpeg.c) is used for handling JPEG icons. This library doesn't support lossless JPEG. - diff --git a/common/theme.c b/common/theme.c index eeb12cd..f4b01b9 100644 --- a/common/theme.c +++ b/common/theme.c @@ -29,6 +29,7 @@ void themeStartup(ThemePreset preset) { //.buttonBImage = button_b_light_bin, .hbmenuLogoImage = hbmenu_logo_light_bin }; + theme_t themeDark = (theme_t) { .textColor = MakeColor(255, 255, 255, 255), .frontWaveColor = MakeColor(96, 204, 204, 255), @@ -44,6 +45,7 @@ void themeStartup(ThemePreset preset) { //.buttonBImage = button_b_dark_bin, .hbmenuLogoImage = hbmenu_logo_dark_bin }; + theme_t *themeDefault; config_t *cfg = NULL; cfg = (config_t *) malloc(sizeof(config_t)); @@ -53,6 +55,7 @@ void themeStartup(ThemePreset preset) { int waveBlending; const char *AText, *BText; bool good_cfg=config_read_file(cfg, "/hbtheme.cfg"); + switch (preset) { case THEME_PRESET_LIGHT: themeDefault = &themeLight; @@ -65,9 +68,14 @@ void themeStartup(ThemePreset preset) { if (good_cfg) theme = config_lookup(cfg, "darkTheme"); break; + default: + themeDefault = &themeDark; + if (good_cfg) + theme = config_lookup(cfg, "darkTheme"); } + if (good_cfg){ - if (theme !=NULL){ + if (theme != NULL) { if (!colorFromSetting(config_setting_lookup(theme, "textColor"), &text)) text = themeDefault->textColor; if (!colorFromSetting(config_setting_lookup(theme, "frontWaveColor"), &frontWave))