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?
This commit is contained in:
friedkeenan 2018-09-10 20:13:50 -05:00 committed by GitHub
parent e42df316d7
commit 3ae331a2b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 2 deletions

View File

@ -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). * 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. * [nanojpeg](https://svn.emphy.de/nanojpeg/trunk/nanojpeg/nanojpeg.c) is used for handling JPEG icons. This library doesn't support lossless JPEG.

View File

@ -29,6 +29,7 @@ void themeStartup(ThemePreset preset) {
//.buttonBImage = button_b_light_bin, //.buttonBImage = button_b_light_bin,
.hbmenuLogoImage = hbmenu_logo_light_bin .hbmenuLogoImage = hbmenu_logo_light_bin
}; };
theme_t themeDark = (theme_t) { theme_t themeDark = (theme_t) {
.textColor = MakeColor(255, 255, 255, 255), .textColor = MakeColor(255, 255, 255, 255),
.frontWaveColor = MakeColor(96, 204, 204, 255), .frontWaveColor = MakeColor(96, 204, 204, 255),
@ -44,6 +45,7 @@ void themeStartup(ThemePreset preset) {
//.buttonBImage = button_b_dark_bin, //.buttonBImage = button_b_dark_bin,
.hbmenuLogoImage = hbmenu_logo_dark_bin .hbmenuLogoImage = hbmenu_logo_dark_bin
}; };
theme_t *themeDefault; theme_t *themeDefault;
config_t *cfg = NULL; config_t *cfg = NULL;
cfg = (config_t *) malloc(sizeof(config_t)); cfg = (config_t *) malloc(sizeof(config_t));
@ -53,6 +55,7 @@ void themeStartup(ThemePreset preset) {
int waveBlending; int waveBlending;
const char *AText, *BText; const char *AText, *BText;
bool good_cfg=config_read_file(cfg, "/hbtheme.cfg"); bool good_cfg=config_read_file(cfg, "/hbtheme.cfg");
switch (preset) { switch (preset) {
case THEME_PRESET_LIGHT: case THEME_PRESET_LIGHT:
themeDefault = &themeLight; themeDefault = &themeLight;
@ -65,9 +68,14 @@ void themeStartup(ThemePreset preset) {
if (good_cfg) if (good_cfg)
theme = config_lookup(cfg, "darkTheme"); theme = config_lookup(cfg, "darkTheme");
break; break;
default:
themeDefault = &themeDark;
if (good_cfg)
theme = config_lookup(cfg, "darkTheme");
} }
if (good_cfg){ if (good_cfg){
if (theme !=NULL){ if (theme != NULL) {
if (!colorFromSetting(config_setting_lookup(theme, "textColor"), &text)) if (!colorFromSetting(config_setting_lookup(theme, "textColor"), &text))
text = themeDefault->textColor; text = themeDefault->textColor;
if (!colorFromSetting(config_setting_lookup(theme, "frontWaveColor"), &frontWave)) if (!colorFromSetting(config_setting_lookup(theme, "frontWaveColor"), &frontWave))