Added remaining basic terminal colours

Added bar_text style
This commit is contained in:
James Booth
2012-06-18 23:38:34 +01:00
parent 8f0d9511d9
commit 9427e64481
3 changed files with 14 additions and 1 deletions

View File

@@ -41,7 +41,7 @@ struct colour_string_t {
NCURSES_COLOR_T colour; NCURSES_COLOR_T colour;
}; };
static int num_colours = 7; static int num_colours = 9;
static struct colour_string_t colours[] = { static struct colour_string_t colours[] = {
{ "default", -1 }, { "default", -1 },
{ "white", COLOR_WHITE }, { "white", COLOR_WHITE },
@@ -50,6 +50,8 @@ static struct colour_string_t colours[] = {
{ "yellow", COLOR_YELLOW }, { "yellow", COLOR_YELLOW },
{ "blue", COLOR_BLUE }, { "blue", COLOR_BLUE },
{ "cyan", COLOR_CYAN }, { "cyan", COLOR_CYAN },
{ "black", COLOR_BLACK },
{ "magenta", COLOR_MAGENTA },
}; };
// colour preferences // colour preferences
@@ -62,6 +64,7 @@ static struct colours_t {
NCURSES_COLOR_T inc; NCURSES_COLOR_T inc;
NCURSES_COLOR_T bar; NCURSES_COLOR_T bar;
NCURSES_COLOR_T bar_draw; NCURSES_COLOR_T bar_draw;
NCURSES_COLOR_T bar_text;
} colour_prefs; } colour_prefs;
static NCURSES_COLOR_T _lookup_colour(const char * const colour); static NCURSES_COLOR_T _lookup_colour(const char * const colour);
@@ -144,6 +147,9 @@ static void _load_colours(void)
gchar *bar_draw_val = g_key_file_get_string(prefs, "colours", "bar_draw", NULL); gchar *bar_draw_val = g_key_file_get_string(prefs, "colours", "bar_draw", NULL);
_set_colour(bar_draw_val, &colour_prefs.bar_draw, COLOR_CYAN); _set_colour(bar_draw_val, &colour_prefs.bar_draw, COLOR_CYAN);
gchar *bar_text_val = g_key_file_get_string(prefs, "colours", "bar_text", NULL);
_set_colour(bar_text_val, &colour_prefs.bar_text, COLOR_WHITE);
} }
char * find_login(char *prefix) char * find_login(char *prefix)
@@ -276,3 +282,8 @@ NCURSES_COLOR_T prefs_get_bar_draw()
{ {
return colour_prefs.bar_draw; return colour_prefs.bar_draw;
} }
NCURSES_COLOR_T prefs_get_bar_text()
{
return colour_prefs.bar_text;
}

View File

@@ -46,5 +46,6 @@ NCURSES_COLOR_T prefs_get_err();
NCURSES_COLOR_T prefs_get_inc(); NCURSES_COLOR_T prefs_get_inc();
NCURSES_COLOR_T prefs_get_bar(); NCURSES_COLOR_T prefs_get_bar();
NCURSES_COLOR_T prefs_get_bar_draw(); NCURSES_COLOR_T prefs_get_bar_draw();
NCURSES_COLOR_T prefs_get_bar_text();
#endif #endif

View File

@@ -85,6 +85,7 @@ void gui_init(void)
init_pair(5, prefs_get_offline(), prefs_get_bkgnd()); init_pair(5, prefs_get_offline(), prefs_get_bkgnd());
init_pair(6, prefs_get_err(), prefs_get_bkgnd()); init_pair(6, prefs_get_err(), prefs_get_bkgnd());
init_pair(7, prefs_get_inc(), prefs_get_bkgnd()); init_pair(7, prefs_get_inc(), prefs_get_bkgnd());
init_pair(8, prefs_get_bar_text(), prefs_get_bar());
} }
refresh(); refresh();