add support for dim colors
This commit is contained in:
parent
a5fa9c0a05
commit
d14a6b3346
28
termite.c
28
termite.c
|
@ -400,7 +400,7 @@ static void load_config(GtkWindow *window, VteTerminal *vte,
|
|||
vte_terminal_set_opacity(vte, (guint16)(0xffff * (1 - cfgdouble)));
|
||||
}
|
||||
|
||||
static const long palette_size = 16;
|
||||
static const long palette_size = 24;
|
||||
GdkColor color, palette[palette_size];
|
||||
|
||||
static const char *colors[8] = {"black", "red", "green", "yellow",
|
||||
|
@ -410,24 +410,26 @@ static void load_config(GtkWindow *window, VteTerminal *vte,
|
|||
for (unsigned i = 0; success && i < 8; i++) {
|
||||
GError *error = NULL;
|
||||
gsize length;
|
||||
char **pair = g_key_file_get_string_list(config, "colors", colors[i], &length, &error);
|
||||
char **triplet = g_key_file_get_string_list(config, "colors", colors[i], &length, &error);
|
||||
success = false;
|
||||
if (error) {
|
||||
g_error_free(error);
|
||||
} else if (length != 2) {
|
||||
g_printerr("%s is not set to a pair of color strings\n", colors[i]);
|
||||
} else if (!gdk_color_parse(pair[0], &palette[i])) {
|
||||
g_printerr("invalid color string: %s\n", pair[0]);
|
||||
} else if (!gdk_color_parse(pair[1], &palette[i+8])) {
|
||||
g_printerr("invalid color string: %s\n", pair[1]);
|
||||
} else if (length != 3) {
|
||||
g_printerr("%s is not set to a triplet of color strings\n", colors[i]);
|
||||
} else if (!gdk_color_parse(triplet[0], &palette[i])) {
|
||||
g_printerr("invalid color string: %s\n", triplet[0]);
|
||||
} else if (!gdk_color_parse(triplet[1], &palette[i+8])) {
|
||||
g_printerr("invalid color string: %s\n", triplet[1]);
|
||||
} else if (!gdk_color_parse(triplet[2], &palette[i+16])) {
|
||||
g_printerr("invalid color string: %s\n", triplet[2]);
|
||||
} else {
|
||||
success = true;
|
||||
}
|
||||
g_strfreev(pair);
|
||||
g_strfreev(triplet);
|
||||
}
|
||||
|
||||
if (success) {
|
||||
vte_terminal_set_colors(vte, NULL, NULL, palette, palette_size);
|
||||
if (get_config_color(config, "dim", &color)) {
|
||||
vte_terminal_set_color_dim(vte, &color);
|
||||
}
|
||||
|
||||
if (get_config_color(config, "foreground", &color)) {
|
||||
|
@ -438,6 +440,10 @@ static void load_config(GtkWindow *window, VteTerminal *vte,
|
|||
vte_terminal_set_color_background(vte, &color);
|
||||
}
|
||||
|
||||
if (success) {
|
||||
vte_terminal_set_colors(vte, NULL, NULL, palette, palette_size);
|
||||
}
|
||||
|
||||
if (get_config_color(config, "cursor", &color)) {
|
||||
vte_terminal_set_color_cursor(vte, &color);
|
||||
}
|
||||
|
|
19
termite.cfg
19
termite.cfg
|
@ -32,14 +32,15 @@ cursor_shape = BLOCK
|
|||
[colors]
|
||||
foreground = #dcdccc
|
||||
background = #3f3f3f
|
||||
dim = #dcdccc
|
||||
#cursor = #dcdccc
|
||||
|
||||
# color = normal;bold
|
||||
black = #3f3f3f;#709080
|
||||
red = #705050;#dca3a3
|
||||
green = #60b48a;#c3bf9f
|
||||
yellow = #dfaf8f;#f0dfaf
|
||||
blue = #506070;#94bff3
|
||||
magenta = #dc8cc3;#ec93d3
|
||||
cyan = #8cd0d3;#93e0e3
|
||||
white = #dcdccc;#ffffff
|
||||
# color = normal;bold;dim
|
||||
black = #3f3f3f;#709080;#3f3f3f
|
||||
red = #705050;#dca3a3;#705050
|
||||
green = #60b48a;#c3bf9f;#60b48a
|
||||
yellow = #dfaf8f;#f0dfaf;#dfaf8f
|
||||
blue = #506070;#94bff3;#506070
|
||||
magenta = #dc8cc3;#ec93d3;#dc8cc3
|
||||
cyan = #8cd0d3;#93e0e3;#8cd0d3
|
||||
white = #dcdccc;#ffffff;#dcdccc
|
||||
|
|
Loading…
Reference in New Issue