added two new theming attributes, borderColor, borderTextcolor, allows users to modify the boxes that surrounds the menu entries

This commit is contained in:
NightlyFox 2018-09-19 23:31:17 -05:00
parent 35a3c646ed
commit 8e2a79c496
3 changed files with 17 additions and 7 deletions

View File

@ -122,7 +122,7 @@ static void drawEntry(menuEntry_s* me, int off_x, int is_active) {
int border_start_x, border_end_x;
int border_start_y, border_end_y;
color_t border_color = MakeColor(255, 255, 255, 255);
color_t border_color = MakeColor(themeCurrent.borderColor.r, themeCurrent.borderColor.g, themeCurrent.borderColor.b, 255);
int shadow_start_y, shadow_y;
int shadow_inset;
@ -132,7 +132,7 @@ static void drawEntry(menuEntry_s* me, int off_x, int is_active) {
int shadow_size = 4;
if (is_active) {
highlight_multiplier = fmax(0.0, fabs(fmod(menuTimer, 1.0) - 0.5) / 0.5);
border_color = MakeColor(themeCurrent.highlightColor.r + (255 - themeCurrent.highlightColor.r) * highlight_multiplier, themeCurrent.highlightColor.g + (255 - themeCurrent.highlightColor.g) * highlight_multiplier, themeCurrent.highlightColor.b + (255 - themeCurrent.highlightColor.b) * highlight_multiplier, 255);
border_start_x = start_x-6;
border_end_x = end_x+6;
@ -201,7 +201,7 @@ static void drawEntry(menuEntry_s* me, int off_x, int is_active) {
for (y=start_y; y<end_y; y++) {
for (x=start_x; x<end_x; x+=4) {
Draw4PixelsRaw(x, y, MakeColor(255, 255, 255, 255));
Draw4PixelsRaw(x, y, MakeColor(themeCurrent.borderColor.r, themeCurrent.borderColor.g, themeCurrent.borderColor.b, 255));//add to theme
}
}
@ -246,8 +246,7 @@ static void drawEntry(menuEntry_s* me, int off_x, int is_active) {
}
}
}
DrawTextTruncate(interuiregular14, start_x + 4, start_y + 4 + 18, MakeColor(64, 64, 64, 255), me->name, 140 - 32, "...");
DrawTextTruncate(interuiregular14, start_x + 4, start_y + 4 + 18, MakeColor(themeCurrent.borderTextColor.r, themeCurrent.borderTextColor.g, themeCurrent.borderTextColor.b, 255), me->name, 140 - 32, "...");//Add to theme
if (is_active) {
start_x = 1280 - 790;

View File

@ -36,6 +36,8 @@ void themeStartup(ThemePreset preset) {
.backgroundColor = MakeColor(233, 236, 241, 255),
.highlightColor = MakeColor(91, 237, 224, 255),
.separatorColor = MakeColor(219, 218, 219, 255),
.borderColor = MakeColor(255,255,255,255),
.borderTextColor = MakeColor(64,64,64,255),
.enableWaveBlending = 0,
.buttonAText = buttonAText,/*setting the buttonAText = "\uE0E0" directly allocates the literal on the stack */
.buttonBText = buttonBText,/*and sets the buttonAText to point to the address of the literal which is why calloc is used above*/
@ -52,6 +54,8 @@ void themeStartup(ThemePreset preset) {
.backgroundColor = MakeColor(45, 45, 50, 255),
.highlightColor = MakeColor(91, 237, 224, 255),
.separatorColor = MakeColor(219, 218, 219, 255),
.borderColor = MakeColor(255,255,255,255),
.borderTextColor = MakeColor(64,64,64,255),
.enableWaveBlending = 0,
.buttonAText = buttonAText,
.buttonBText = buttonBText,
@ -72,7 +76,7 @@ void themeStartup(ThemePreset preset) {
config_t cfg = {0};
config_init(&cfg);
config_setting_t *theme;
color_t text, frontWave, middleWave, backWave, background, highlight, separator;
color_t text, frontWave, middleWave, backWave, background, highlight, separator, borderColor, borderTextColor;
int waveBlending;
const char *AText, *BText;
bool good_cfg = config_read_file(&cfg, tmp_path);
@ -106,6 +110,10 @@ void themeStartup(ThemePreset preset) {
highlight = themeDefault->highlightColor;
if (!colorFromSetting(config_setting_lookup(theme, "separatorColor"), &separator))
separator = themeDefault->separatorColor;
if (!colorFromSetting(config_setting_lookup(theme, "borderColor"), &borderColor))
borderColor = themeDefault->borderColor;
if (!colorFromSetting(config_setting_lookup(theme, "borderTextColor"), &borderTextColor))
borderTextColor = themeDefault->borderTextColor;
if (!config_setting_lookup_int(theme, "enableWaveBlending", &waveBlending))
waveBlending = themeDefault->enableWaveBlending;
if (!config_setting_lookup_string(theme, "buttonAText", &AText))
@ -120,6 +128,8 @@ void themeStartup(ThemePreset preset) {
.backgroundColor = background,
.highlightColor = highlight,
.separatorColor = separator,
.borderColor = borderColor,
.borderTextColor = borderTextColor,
.enableWaveBlending = waveBlending,
.buttonAText = AText,
.buttonBText = BText,

View File

@ -12,7 +12,8 @@ typedef struct
color_t backgroundColor;
color_t highlightColor;
color_t separatorColor;
color_t activeColor;
color_t borderColor;
color_t borderTextColor;
bool enableWaveBlending;
const char *buttonAText;
const char *buttonBText;