Preliminary dark theme. De-harcoded some colors, refactored some names

to be clearer to me,
created a new color.
This commit is contained in:
Arzed Five 2016-07-03 16:35:07 +01:00 committed by twinaphex
parent 2dac910964
commit b57a203557

View File

@ -217,7 +217,7 @@ static void mui_draw_icon(
static void mui_draw_tab(mui_handle_t *mui,
unsigned i,
unsigned width, unsigned height,
float *pure_white)
float *tab_color)
{
unsigned tab_icon = 0;
@ -249,7 +249,7 @@ static void mui_draw_tab(mui_handle_t *mui,
height,
0,
1,
&pure_white[0]);
&tab_color[0]); /* default color is pure_white */
}
static void mui_draw_text(float x, float y, unsigned width, unsigned height,
@ -305,7 +305,7 @@ static void mui_render_quad(mui_handle_t *mui,
static void mui_draw_tab_begin(mui_handle_t *mui,
unsigned width, unsigned height,
float *white_bg, float *grey_bg)
float *tabs_bg_color, float *tabs_separator_color)
{
float scale_factor = menu_display_get_dpi();
@ -315,19 +315,19 @@ static void mui_draw_tab_begin(mui_handle_t *mui,
mui_render_quad(mui, 0, height - mui->tabs_height, width,
mui->tabs_height,
width, height,
white_bg);
tabs_bg_color); /* white_bg */
/* tabs separator */
mui_render_quad(mui, 0, height - mui->tabs_height, width,
1,
width, height,
grey_bg);
tabs_separator_color); /* grey_bg */
}
static void mui_draw_tab_end(mui_handle_t *mui,
unsigned width, unsigned height,
unsigned header_height,
float *blue_bg)
float *active_tab_marker_color)
{
/* active tab marker */
unsigned tab_width = width / (MUI_SYSTEM_TAB_END+1);
@ -337,7 +337,7 @@ static void mui_draw_tab_end(mui_handle_t *mui,
tab_width,
header_height/16,
width, height,
&blue_bg[0]);
&active_tab_marker_color[0]); /* blue_bg */
}
static void mui_draw_scrollbar(mui_handle_t *mui,
@ -391,7 +391,7 @@ static void mui_get_message(void *data, const char *message)
static void mui_render_messagebox(const char *message)
{
unsigned i, width, height;
uint32_t normal_color;
uint32_t font_normal_color;
int x, y, font_size;
settings_t *settings = config_get_ptr();
struct string_list *list = (struct string_list*)
@ -409,7 +409,7 @@ static void mui_render_messagebox(const char *message)
x = width / 2;
y = height / 2 - list->size * font_size / 2;
normal_color = FONT_COLOR_ARGB_TO_RGBA(settings->menu.entry_normal_color);
font_normal_color = FONT_COLOR_ARGB_TO_RGBA(settings->menu.entry_normal_color);
for (i = 0; i < list->size; i++)
{
@ -417,7 +417,7 @@ static void mui_render_messagebox(const char *message)
if (msg)
mui_draw_text(x, y + i * font_size,
width, height,
msg, normal_color, TEXT_ALIGN_CENTER);
msg, font_normal_color, TEXT_ALIGN_CENTER);
}
end:
@ -595,14 +595,14 @@ static void mui_render_label_value(mui_handle_t *mui,
height,
0,
1,
&pure_white[0]);
&pure_white[0]); /* pure_white */
}
static void mui_render_menu_list(mui_handle_t *mui,
unsigned width, unsigned height,
uint32_t normal_color,
uint32_t hover_color,
float *pure_white)
uint32_t font_normal_color,
uint32_t font_hover_color,
float *menu_list_color)
{
unsigned header_height;
uint64_t *frame_count;
@ -641,9 +641,18 @@ static void mui_render_menu_list(mui_handle_t *mui,
entry_selected = selection == i;
mui_render_label_value(mui, y, width, height, *frame_count / 20,
entry_selected ? hover_color : normal_color, entry_selected,
rich_label, entry.value, pure_white);
mui_render_label_value(
mui,
y,
width,
height,
*frame_count / 20,
entry_selected ? font_hover_color : font_normal_color,
entry_selected,
rich_label,
entry.value,
menu_list_color /* pure_white */
);
}
}
@ -766,6 +775,47 @@ static void mui_frame(void *data)
0, 0, 0, 0.2,
0, 0, 0, 0.2,
};
float greyish_blue[16] = {
0.22, 0.28, 0.31, 1,
0.22, 0.28, 0.31, 1,
0.22, 0.28, 0.31, 1,
0.22, 0.28, 0.31, 1,
};
bool DARK_THEME = false;
float *header_bg_color = blue_bg;
float *highlighted_entry_color = lightblue_bg;
float *footer_bg_color = white_bg;
uint32_t font_normal_color = 0x212121ff;
uint32_t font_hover_color = 0x212121ff;
uint32_t font_header_color = 0xffffffff;
uint32_t activetab_color = 0x0096f2ff;
uint32_t passivetab_color = 0x9e9e9eff;
/* This controls the main background color */
menu_display_ctx_clearcolor_t clearcolor;
clearcolor.r = 1.0f;
clearcolor.g = 1.0f;
clearcolor.b = 1.0f;
clearcolor.a = 0.75f;
if (DARK_THEME) {
header_bg_color = greyish_blue;
highlighted_entry_color = grey_bg;
footer_bg_color = black_bg;
font_normal_color = 0xffffffff;
font_hover_color = 0x00000000;
clearcolor.r = 0.13f;
clearcolor.g = 0.13f;
clearcolor.b = 0.13f;
}
menu_animation_ctx_ticker_t ticker;
unsigned width, height, ticker_limit, i;
size_t selection;
@ -777,17 +827,9 @@ static void mui_frame(void *data)
char title[256] = {0};
char title_buf[256] = {0};
char title_msg[256] = {0};
const uint32_t normal_color = 0x212121ff;
const uint32_t hover_color = 0x212121ff;
const uint32_t title_color = 0xffffffff;
const uint32_t activetab_color = 0x0096f2ff;
const uint32_t passivetab_color = 0x9e9e9eff;
bool background_rendered = false;
bool libretro_running = menu_display_libretro_running();
(void)passivetab_color;
(void)activetab_color;
if (!mui)
return;
@ -816,13 +858,6 @@ static void mui_frame(void *data)
}
else
{
menu_display_ctx_clearcolor_t clearcolor;
clearcolor.r = 1.0f;
clearcolor.g = 1.0f;
clearcolor.b = 1.0f;
clearcolor.a = 0.75f;
menu_display_clear_color(&clearcolor);
if (mui->textures.bg)
@ -863,30 +898,48 @@ static void mui_frame(void *data)
menu_display_set_alpha(lightblue_bg, 1.0);
/* highlighted entry */
mui_render_quad(mui, 0,
header_height - mui->scroll_y + mui->line_height *
selection, width, mui->line_height,
width, height,
&lightblue_bg[0]);
mui_render_quad(
mui,
0,
header_height - mui->scroll_y + mui->line_height *selection,
width,
mui->line_height,
width,
height,
&highlighted_entry_color[0]
);
menu_display_font_bind_block(&mui->list_block);
mui_render_menu_list(mui, width, height,
normal_color, hover_color, &pure_white[0]);
mui_render_menu_list(
mui,
width,
height,
font_normal_color,
font_hover_color,
&pure_white[0]
);
menu_display_font_flush_block();
menu_animation_ctl(MENU_ANIMATION_CTL_SET_ACTIVE, NULL);
/* header */
mui_render_quad(mui, 0, 0, width, header_height,
width, height, &blue_bg[0]);
mui_render_quad(
mui,
0,
0,
width,
header_height,
width,
height,
&header_bg_color[0]);
mui->tabs_height = 0;
/* display tabs if depth equal one, if not hide them */
if (mui_list_get_size(mui, MENU_LIST_PLAIN) == 1)
{
mui_draw_tab_begin(mui, width, height, &white_bg[0], &grey_bg[0]);
mui_draw_tab_begin(mui, width, height, &footer_bg_color[0], &grey_bg[0]);
for (i = 0; i <= MUI_SYSTEM_TAB_END; i++)
mui_draw_tab(mui, i, width, height, &pure_white[0]);
@ -894,10 +947,15 @@ static void mui_frame(void *data)
mui_draw_tab_end(mui, width, height, header_height, &blue_bg[0]);
}
mui_render_quad(mui, 0, header_height, width,
mui->shadow_height,
width, height,
&shadow_bg[0]);
mui_render_quad(
mui,
0,
header_height,
width,
mui->shadow_height,
width,
height,
&shadow_bg[0]);
title_margin = mui->margin;
@ -905,15 +963,16 @@ static void mui_frame(void *data)
{
title_margin = mui->icon_size;
mui_draw_icon(
mui->icon_size,
mui->textures.list[MUI_TEXTURE_BACK],
0,
0,
width,
height,
0,
1,
&pure_white[0]);
mui->icon_size,
mui->textures.list[MUI_TEXTURE_BACK],
0,
0,
width,
height,
0,
1,
&pure_white[0]
);
}
ticker_limit = (width - mui->margin*2) / mui->glyph_width;
@ -951,7 +1010,7 @@ static void mui_frame(void *data)
}
mui_draw_text(title_margin, header_height / 2, width, height,
title_buf, title_color, TEXT_ALIGN_LEFT);
title_buf, font_header_color, TEXT_ALIGN_LEFT);
mui_draw_scrollbar(mui, width, height, &grey_bg[0]);