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)));
|
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];
|
GdkColor color, palette[palette_size];
|
||||||
|
|
||||||
static const char *colors[8] = {"black", "red", "green", "yellow",
|
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++) {
|
for (unsigned i = 0; success && i < 8; i++) {
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
gsize length;
|
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;
|
success = false;
|
||||||
if (error) {
|
if (error) {
|
||||||
g_error_free(error);
|
g_error_free(error);
|
||||||
} else if (length != 2) {
|
} else if (length != 3) {
|
||||||
g_printerr("%s is not set to a pair of color strings\n", colors[i]);
|
g_printerr("%s is not set to a triplet of color strings\n", colors[i]);
|
||||||
} else if (!gdk_color_parse(pair[0], &palette[i])) {
|
} else if (!gdk_color_parse(triplet[0], &palette[i])) {
|
||||||
g_printerr("invalid color string: %s\n", pair[0]);
|
g_printerr("invalid color string: %s\n", triplet[0]);
|
||||||
} else if (!gdk_color_parse(pair[1], &palette[i+8])) {
|
} else if (!gdk_color_parse(triplet[1], &palette[i+8])) {
|
||||||
g_printerr("invalid color string: %s\n", pair[1]);
|
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 {
|
} else {
|
||||||
success = true;
|
success = true;
|
||||||
}
|
}
|
||||||
g_strfreev(pair);
|
g_strfreev(triplet);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (success) {
|
if (get_config_color(config, "dim", &color)) {
|
||||||
vte_terminal_set_colors(vte, NULL, NULL, palette, palette_size);
|
vte_terminal_set_color_dim(vte, &color);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (get_config_color(config, "foreground", &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);
|
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)) {
|
if (get_config_color(config, "cursor", &color)) {
|
||||||
vte_terminal_set_color_cursor(vte, &color);
|
vte_terminal_set_color_cursor(vte, &color);
|
||||||
}
|
}
|
||||||
|
|
19
termite.cfg
19
termite.cfg
|
@ -32,14 +32,15 @@ cursor_shape = BLOCK
|
||||||
[colors]
|
[colors]
|
||||||
foreground = #dcdccc
|
foreground = #dcdccc
|
||||||
background = #3f3f3f
|
background = #3f3f3f
|
||||||
|
dim = #dcdccc
|
||||||
#cursor = #dcdccc
|
#cursor = #dcdccc
|
||||||
|
|
||||||
# color = normal;bold
|
# color = normal;bold;dim
|
||||||
black = #3f3f3f;#709080
|
black = #3f3f3f;#709080;#3f3f3f
|
||||||
red = #705050;#dca3a3
|
red = #705050;#dca3a3;#705050
|
||||||
green = #60b48a;#c3bf9f
|
green = #60b48a;#c3bf9f;#60b48a
|
||||||
yellow = #dfaf8f;#f0dfaf
|
yellow = #dfaf8f;#f0dfaf;#dfaf8f
|
||||||
blue = #506070;#94bff3
|
blue = #506070;#94bff3;#506070
|
||||||
magenta = #dc8cc3;#ec93d3
|
magenta = #dc8cc3;#ec93d3;#dc8cc3
|
||||||
cyan = #8cd0d3;#93e0e3
|
cyan = #8cd0d3;#93e0e3;#8cd0d3
|
||||||
white = #dcdccc;#ffffff
|
white = #dcdccc;#ffffff;#dcdccc
|
||||||
|
|
Loading…
Reference in New Issue