diff --git a/config.h b/config.h index 8ab0005..0108c5c 100644 --- a/config.h +++ b/config.h @@ -5,9 +5,6 @@ static const char *url_regex = "(ftp|http)s?://[-a-zA-Z0-9.?$%&/=_~#.,:;+]*"; // 0.0: opaque, 1.0: transparent //#define TRANSPARENCY 0.2 -static const char *foreground_color = "#dcdccc"; -static const char *background_color = "#3f3f3f"; - static const char *palette_s[16] = { "#3f3f3f", // black "#705050", // red diff --git a/termite.c b/termite.c index 293cf0a..4ef59f4 100644 --- a/termite.c +++ b/termite.c @@ -334,14 +334,27 @@ static void load_config(GtkWindow *window, VteTerminal *vte, g_free(icon_name); } - gdk_color_parse(foreground_color, &colors->foreground); - gdk_color_parse(background_color, &colors->background); - for (unsigned i = 0; i < 16; i++) { gdk_color_parse(palette_s[i], &colors->palette[i]); } - vte_terminal_set_colors(vte, &colors->foreground, &colors->background, colors->palette, 16); + vte_terminal_set_colors(vte, NULL, NULL, colors->palette, 16); + + gchar *foreground_color = g_key_file_get_string(config, "colors", "foreground", &error); + IGNORE_ON_ERROR(error) { + if (gdk_color_parse(foreground_color, &colors->foreground)) { + vte_terminal_set_color_foreground(vte, &colors->foreground); + } + g_free(foreground_color); + } + + gchar *background_color = g_key_file_get_string(config, "colors", "background", &error); + IGNORE_ON_ERROR(error) { + if (gdk_color_parse(background_color, &colors->background)) { + vte_terminal_set_color_background(vte, &colors->background); + } + g_free(background_color); + } gchar *cursor_color = g_key_file_get_string(config, "colors", "cursor", &error); IGNORE_ON_ERROR(error) { diff --git a/termite.cfg b/termite.cfg index 2dca298..2689fd3 100644 --- a/termite.cfg +++ b/termite.cfg @@ -19,4 +19,6 @@ cursor_blink = SYSTEM cursor_shape = BLOCK [colors] +foreground = #dcdccc +background = #3f3f3f cursor = #dcdccc