Revert readme and fix formatting
This commit is contained in:
parent
20221d6b0d
commit
43af1fc96f
@ -1,11 +1,8 @@
|
|||||||
#### Theming
|
|
||||||
See the [example](https://github.com/friedkeenan/nx-hbmenu/releases/download/2.0.1/hbtheme.cfg) in the releases for the correct structure. In short, there are two seperate entries for the dark and light system themes, but you only need to make a them for one of them for it to work. If there are any colors missing, the missing color is set to #800080 (purple), and if anything else is wrong the theme won't take effect. You place the hbtheme.cfg file on the root of the SD card and then you should be good to go.
|
|
||||||
|
|
||||||
#### Usage
|
#### Usage
|
||||||
See [Homebrew_Applications](http://switchbrew.org/index.php?title=Homebrew_Applications) for SD layout and applications, etc. See [Switchbrew](http://switchbrew.org/index.php?title=Homebrew_Menu) for hbmenu docs.
|
See [Homebrew_Applications](http://switchbrew.org/index.php?title=Homebrew_Applications) for SD layout and applications, etc. See [Switchbrew](http://switchbrew.org/index.php?title=Homebrew_Menu) for hbmenu docs.
|
||||||
|
|
||||||
#### Download
|
#### Download
|
||||||
The latest release is available from the [releases](https://github.com/friedkeenan/nx-hbmenu/releases/latest) page.
|
The latest release is available from the [releases](https://github.com/switchbrew/nx-hbmenu/releases/latest) page.
|
||||||
|
|
||||||
#### Building
|
#### Building
|
||||||
Build with ```make nx``` or just run ```make```.
|
Build with ```make nx``` or just run ```make```.
|
||||||
@ -14,3 +11,4 @@ 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.
|
||||||
|
|
||||||
|
201
common/theme.c
201
common/theme.c
@ -7,119 +7,120 @@
|
|||||||
#include "hbmenu_logo_dark_bin.h"
|
#include "hbmenu_logo_dark_bin.h"
|
||||||
|
|
||||||
color_t colorFromSetting(config_setting_t *rgba) {
|
color_t colorFromSetting(config_setting_t *rgba) {
|
||||||
if(rgba==NULL)
|
if(rgba==NULL)
|
||||||
return MakeColor(128,0,128,255);
|
return MakeColor(128,0,128,255);
|
||||||
return MakeColor(config_setting_get_int_elem(rgba, 0), config_setting_get_int_elem(rgba, 1), config_setting_get_int_elem(rgba, 2), config_setting_get_int_elem(rgba, 3));
|
return MakeColor(config_setting_get_int_elem(rgba, 0), config_setting_get_int_elem(rgba, 1), config_setting_get_int_elem(rgba, 2), config_setting_get_int_elem(rgba, 3));
|
||||||
}
|
}
|
||||||
|
|
||||||
void themeStartup(ThemePreset preset) {
|
void themeStartup(ThemePreset preset) {
|
||||||
config_t *cfg = NULL;
|
config_t *cfg = NULL;
|
||||||
cfg = (config_t *) malloc(sizeof(config_t));
|
cfg = (config_t *) malloc(sizeof(config_t));
|
||||||
config_init(cfg);
|
config_init(cfg);
|
||||||
config_setting_t *theme;
|
config_setting_t *theme;
|
||||||
color_t text, frontWave, middleWave, backWave, background, highlight, separator;
|
color_t text, frontWave, middleWave, backWave, background, highlight, separator;
|
||||||
int waveBlending;
|
int waveBlending;
|
||||||
const char *AText, *BText;
|
const char *AText, *BText;
|
||||||
bool good_cfg=false;
|
bool good_cfg=false;
|
||||||
switch (preset) {
|
switch (preset) {
|
||||||
case THEME_PRESET_LIGHT:
|
case THEME_PRESET_LIGHT:
|
||||||
if (config_read_file(cfg, "/hbtheme.cfg")) {
|
if (config_read_file(cfg, "/hbtheme.cfg")) {
|
||||||
theme=config_lookup(cfg, "lightTheme");
|
theme=config_lookup(cfg, "lightTheme");
|
||||||
if (theme != NULL) {
|
if (theme != NULL) {
|
||||||
text = colorFromSetting(config_lookup(cfg, "lightTheme.textColor"));
|
text = colorFromSetting(config_lookup(cfg, "lightTheme.textColor"));
|
||||||
frontWave = colorFromSetting(config_lookup(cfg, "lightTheme.frontWaveColor"));
|
frontWave = colorFromSetting(config_lookup(cfg, "lightTheme.frontWaveColor"));
|
||||||
middleWave = colorFromSetting(config_lookup(cfg, "lightTheme.middleWaveColor"));
|
middleWave = colorFromSetting(config_lookup(cfg, "lightTheme.middleWaveColor"));
|
||||||
backWave = colorFromSetting(config_lookup(cfg, "lightTheme.backWaveColor"));
|
backWave = colorFromSetting(config_lookup(cfg, "lightTheme.backWaveColor"));
|
||||||
background = colorFromSetting(config_lookup(cfg, "lightTheme.backgroundColor"));
|
background = colorFromSetting(config_lookup(cfg, "lightTheme.backgroundColor"));
|
||||||
highlight = colorFromSetting(config_lookup(cfg, "lightTheme.highlightColor"));
|
highlight = colorFromSetting(config_lookup(cfg, "lightTheme.highlightColor"));
|
||||||
separator = colorFromSetting(config_lookup(cfg, "lightTheme.separatorColor"));
|
separator = colorFromSetting(config_lookup(cfg, "lightTheme.separatorColor"));
|
||||||
good_cfg = config_setting_lookup_int(theme, "enableWaveBlending", &waveBlending);
|
good_cfg = config_setting_lookup_int(theme, "enableWaveBlending", &waveBlending);
|
||||||
good_cfg = good_cfg && config_setting_lookup_string(theme, "buttonAText", &AText);
|
good_cfg = good_cfg && config_setting_lookup_string(theme, "buttonAText", &AText);
|
||||||
good_cfg = good_cfg && config_setting_lookup_string(theme, "buttonBText", &BText);
|
good_cfg = good_cfg && config_setting_lookup_string(theme, "buttonBText", &BText);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (good_cfg) {
|
if (good_cfg) {
|
||||||
themeCurrent = (theme_t) {
|
themeCurrent = (theme_t) {
|
||||||
.textColor = text,
|
.textColor = text,
|
||||||
.frontWaveColor = frontWave,
|
.frontWaveColor = frontWave,
|
||||||
.middleWaveColor = middleWave,
|
.middleWaveColor = middleWave,
|
||||||
.backWaveColor = backWave,
|
.backWaveColor = backWave,
|
||||||
.backgroundColor = background,
|
.backgroundColor = background,
|
||||||
.highlightColor = highlight,
|
.highlightColor = highlight,
|
||||||
.separatorColor = separator,
|
.separatorColor = separator,
|
||||||
.enableWaveBlending = waveBlending,
|
.enableWaveBlending = waveBlending,
|
||||||
.buttonAText = AText,
|
.buttonAText = AText,
|
||||||
.buttonBText = BText,
|
.buttonBText = BText,
|
||||||
//.buttonAImage = button_a_light_bin,
|
//.buttonAImage = button_a_light_bin,
|
||||||
//.buttonBImage = button_b_light_bin,
|
//.buttonBImage = button_b_light_bin,
|
||||||
.hbmenuLogoImage = hbmenu_logo_light_bin
|
.hbmenuLogoImage = hbmenu_logo_light_bin
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
themeCurrent = (theme_t) {
|
themeCurrent = (theme_t) {
|
||||||
.textColor = MakeColor(0, 0, 0, 255),
|
.textColor = MakeColor(0, 0, 0, 255),
|
||||||
.frontWaveColor = MakeColor(100, 212, 250, 255),
|
.frontWaveColor = MakeColor(100, 212, 250, 255),
|
||||||
.middleWaveColor = MakeColor(100, 153, 255, 255),
|
.middleWaveColor = MakeColor(100, 153, 255, 255),
|
||||||
.backWaveColor = MakeColor(154, 171, 255, 255),
|
.backWaveColor = MakeColor(154, 171, 255, 255),
|
||||||
.backgroundColor = MakeColor(233, 236, 241, 255),
|
.backgroundColor = MakeColor(233, 236, 241, 255),
|
||||||
.highlightColor = MakeColor(91, 237, 224, 255),
|
.highlightColor = MakeColor(91, 237, 224, 255),
|
||||||
.separatorColor = MakeColor(219, 218, 219, 255),
|
.separatorColor = MakeColor(219, 218, 219, 255),
|
||||||
.enableWaveBlending = 0,
|
.enableWaveBlending = 0,
|
||||||
.buttonAText = "\uE0E0",
|
.buttonAText = "\uE0E0",
|
||||||
.buttonBText = "\uE0E1",
|
.buttonBText = "\uE0E1",
|
||||||
//.buttonAImage = button_a_light_bin,
|
//.buttonAImage = button_a_light_bin,
|
||||||
//.buttonBImage = button_b_light_bin,
|
//.buttonBImage = button_b_light_bin,
|
||||||
.hbmenuLogoImage = hbmenu_logo_light_bin
|
.hbmenuLogoImage = hbmenu_logo_light_bin
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case THEME_PRESET_DARK:
|
case THEME_PRESET_DARK:
|
||||||
if (config_read_file(cfg, "/hbtheme.cfg")) {
|
if (config_read_file(cfg, "/hbtheme.cfg")) {
|
||||||
theme=config_lookup(cfg, "darkTheme");
|
theme=config_lookup(cfg, "darkTheme");
|
||||||
if (theme != NULL) {
|
if (theme != NULL) {
|
||||||
text = colorFromSetting(config_lookup(cfg, "darkTheme.textColor"));
|
text = colorFromSetting(config_lookup(cfg, "darkTheme.textColor"));
|
||||||
frontWave = colorFromSetting(config_lookup(cfg, "darkTheme.frontWaveColor"));
|
frontWave = colorFromSetting(config_lookup(cfg, "darkTheme.frontWaveColor"));
|
||||||
middleWave = colorFromSetting(config_lookup(cfg, "darkTheme.middleWaveColor"));
|
middleWave = colorFromSetting(config_lookup(cfg, "darkTheme.middleWaveColor"));
|
||||||
backWave = colorFromSetting(config_lookup(cfg, "darkTheme.backWaveColor"));
|
backWave = colorFromSetting(config_lookup(cfg, "darkTheme.backWaveColor"));
|
||||||
background = colorFromSetting(config_lookup(cfg, "darkTheme.backgroundColor"));
|
background = colorFromSetting(config_lookup(cfg, "darkTheme.backgroundColor"));
|
||||||
highlight = colorFromSetting(config_lookup(cfg, "darkTheme.highlightColor"));
|
highlight = colorFromSetting(config_lookup(cfg, "darkTheme.highlightColor"));
|
||||||
separator = colorFromSetting(config_lookup(cfg, "darkTheme.separatorColor"));
|
separator = colorFromSetting(config_lookup(cfg, "darkTheme.separatorColor"));
|
||||||
good_cfg = config_setting_lookup_int(theme, "enableWaveBlending", &waveBlending);
|
good_cfg = config_setting_lookup_int(theme, "enableWaveBlending", &waveBlending);
|
||||||
good_cfg = good_cfg && config_setting_lookup_string(theme, "buttonAText", &AText);
|
good_cfg = good_cfg && config_setting_lookup_string(theme, "buttonAText", &AText);
|
||||||
good_cfg = good_cfg && config_setting_lookup_string(theme, "buttonBText", &BText);
|
good_cfg = good_cfg && config_setting_lookup_string(theme, "buttonBText", &BText);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (good_cfg) {
|
if (good_cfg) {
|
||||||
themeCurrent = (theme_t) {
|
themeCurrent = (theme_t) {
|
||||||
.textColor = text,
|
.textColor = text,
|
||||||
.frontWaveColor = frontWave,
|
.frontWaveColor = frontWave,
|
||||||
.middleWaveColor = middleWave,
|
.middleWaveColor = middleWave,
|
||||||
.backWaveColor = backWave,
|
.backWaveColor = backWave,
|
||||||
.backgroundColor = background,
|
.backgroundColor = background,
|
||||||
.highlightColor = highlight,
|
.highlightColor = highlight,
|
||||||
.separatorColor = separator,
|
.separatorColor = separator,
|
||||||
.enableWaveBlending = waveBlending,
|
.enableWaveBlending = waveBlending,
|
||||||
.buttonAText = AText,
|
.buttonAText = AText,
|
||||||
.buttonBText = BText,
|
.buttonBText = BText,
|
||||||
//.buttonAImage = button_a_dark_bin,
|
//.buttonAImage = button_a_dark_bin,
|
||||||
//.buttonBImage = button_b_dark_bin,
|
//.buttonBImage = button_b_dark_bin,
|
||||||
.hbmenuLogoImage = hbmenu_logo_dark_bin
|
.hbmenuLogoImage = hbmenu_logo_dark_bin
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
themeCurrent = (theme_t) {
|
themeCurrent = (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),
|
||||||
.middleWaveColor = MakeColor(66, 154, 159, 255),
|
.middleWaveColor = MakeColor(66, 154, 159, 255),
|
||||||
.backWaveColor = MakeColor(73, 103, 169, 255),
|
.backWaveColor = MakeColor(73, 103, 169, 255),
|
||||||
.backgroundColor = MakeColor(45, 45, 50, 255),
|
.backgroundColor = MakeColor(45, 45, 50, 255),
|
||||||
.highlightColor = MakeColor(91, 237, 224, 255),
|
.highlightColor = MakeColor(91, 237, 224, 255),
|
||||||
.separatorColor = MakeColor(219, 218, 219, 255),
|
.separatorColor = MakeColor(219, 218, 219, 255),
|
||||||
.enableWaveBlending = 0,
|
.enableWaveBlending = 0,
|
||||||
.buttonAText = "\uE0A0",
|
.buttonAText = "\uE0A0",
|
||||||
.buttonBText = "\uE0A1",
|
.buttonBText = "\uE0A1",
|
||||||
//.buttonAImage = button_a_dark_bin,
|
//.buttonAImage = button_a_dark_bin,
|
||||||
//.buttonBImage = button_b_dark_bin,
|
//.buttonBImage = button_b_dark_bin,
|
||||||
.hbmenuLogoImage = hbmenu_logo_dark_bin
|
.hbmenuLogoImage = hbmenu_logo_dark_bin
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,7 @@ typedef enum
|
|||||||
} ThemePreset;
|
} ThemePreset;
|
||||||
|
|
||||||
color_t colorFromSetting(config_setting_t *rgba);
|
color_t colorFromSetting(config_setting_t *rgba);
|
||||||
|
|
||||||
void themeStartup(ThemePreset preset);
|
void themeStartup(ThemePreset preset);
|
||||||
|
|
||||||
theme_t themeCurrent;
|
theme_t themeCurrent;
|
||||||
|
Loading…
Reference in New Issue
Block a user