use config file to set colors

This commit is contained in:
Daniel Micay 2012-06-07 15:01:40 -04:00
parent c2d12b7503
commit f96ea8689d
3 changed files with 29 additions and 23 deletions

View File

@ -5,25 +5,6 @@ static const char *url_regex = "(ftp|http)s?://[-a-zA-Z0-9.?$%&/=_~#.,:;+]*";
// 0.0: opaque, 1.0: transparent // 0.0: opaque, 1.0: transparent
//#define TRANSPARENCY 0.2 //#define TRANSPARENCY 0.2
static const char *palette_s[16] = {
"#3f3f3f", // black
"#705050", // red
"#60b48a", // green
"#dfaf8f", // yellow
"#506070", // blue
"#dc8cc3", // magenta
"#8cd0d3", // cyan
"#dcdccc", // white
"#709080", // bright black
"#dca3a3", // bright red
"#c3bf9f", // bright green
"#f0dfaf", // bright yellow
"#94bff3", // bright blue
"#ec93d3", // bright magenta
"#93e0e3", // bright cyan
"#ffffff", // bright white
};
static const char *term = "vte-256color"; static const char *term = "vte-256color";
// keybindings // keybindings

View File

@ -334,12 +334,18 @@ static void load_config(GtkWindow *window, VteTerminal *vte,
g_free(icon_name); g_free(icon_name);
} }
for (unsigned i = 0; i < 16; i++) { gsize length;
gdk_color_parse(palette_s[i], &colors->palette[i]); gchar **palette_s = g_key_file_get_string_list(config, "colors", "palette", &length, &error);
IGNORE_ON_ERROR(error) {
if (length == 16) {
for (unsigned i = 0; i < 16; i++) {
gdk_color_parse(palette_s[i], &colors->palette[i]);
}
vte_terminal_set_colors(vte, NULL, NULL, colors->palette, 16);
}
g_strfreev(palette_s);
} }
vte_terminal_set_colors(vte, NULL, NULL, colors->palette, 16);
gchar *foreground_color = g_key_file_get_string(config, "colors", "foreground", &error); gchar *foreground_color = g_key_file_get_string(config, "colors", "foreground", &error);
IGNORE_ON_ERROR(error) { IGNORE_ON_ERROR(error) {
if (gdk_color_parse(foreground_color, &colors->foreground)) { if (gdk_color_parse(foreground_color, &colors->foreground)) {

View File

@ -22,3 +22,22 @@ cursor_shape = BLOCK
foreground = #dcdccc foreground = #dcdccc
background = #3f3f3f background = #3f3f3f
cursor = #dcdccc cursor = #dcdccc
# black
# red
# green
# yellow
# blue
# magenta
# cyan
# white
# bright black
# bright red
# bright green
# bright yellow
# bright blue
# bright magenta
# bright cyan
# white
palette = #3f3f3f;#705050;#60b48a;#dfaf8f;#506070;#dc8cc3;#8cd0d3;#dcdccc;#709080;#dca3a3;#c3bf9f;#f0dfaf;#94bff3;#ec93d3;#93e0e3;#ffffff;