From 62c7d1a796bcb6bc5577b643efdc0f753c195e8b Mon Sep 17 00:00:00 2001 From: Jonas Fonseca Date: Sun, 16 Mar 2008 21:26:56 +0100 Subject: [PATCH] Make it possible to overwrite the default (terminal) colors Use the setting of the "default" color pair to set the default colors of the terminal via assume_default_colors(). Fall back to white on black. With this it is possible to no longer use the terminal colors if desired. This was requested by Sebastian Harl as a way to fix Debian bug 399884. --- tig.c | 10 +++++----- tigrc.5.txt | 20 ++++++++++++++------ 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/tig.c b/tig.c index 14f73e6..c614690 100644 --- a/tig.c +++ b/tig.c @@ -697,15 +697,15 @@ get_line_info(char *name, int namelen) static void init_colors(void) { - int default_bg = COLOR_BLACK; - int default_fg = COLOR_WHITE; + int default_bg = line_info[LINE_DEFAULT].bg; + int default_fg = line_info[LINE_DEFAULT].fg; enum line_type type; start_color(); - if (use_default_colors() != ERR) { - default_bg = -1; - default_fg = -1; + if (assume_default_colors(default_fg, default_bg) == ERR) { + default_bg = COLOR_BLACK; + default_fg = COLOR_WHITE; } for (type = 0; type < ARRAY_SIZE(line_info); type++) { diff --git a/tigrc.5.txt b/tigrc.5.txt index 5b2843e..f7d7bed 100644 --- a/tigrc.5.txt +++ b/tigrc.5.txt @@ -256,8 +256,8 @@ Color command Color commands control highlighting and the user interface styles. If your terminal supports color, these commands can be used to assign foreground and -background combinations to certain areas. Optionally, an attribute can be given -as the last parameter. The syntax is: +background combinations to certain areas. Optionally, an attribute can be +given as the last parameter. The syntax is: [verse] .............................................................................. @@ -267,6 +267,8 @@ as the last parameter. The syntax is: Examples: ------------------------------------------------------------------------------ +# Overwrite the default terminal colors to white on black. +color default white black # Diff colors color diff-header yellow default color diff-index blue default @@ -296,12 +298,21 @@ Attribute names:: *standout*, and *underline*. Note, not all attributes may be supported by the terminal. - UI colors ~~~~~~~~~ -- +Default terminal colors:: + +The colors and attributes to be used for the text that is not highlighted or +that specify the use of the default terminal colors can be controlled by +setting the *default* color option. + +Use the *default* color to use the colors configured for the terminal. This is +the default and recommended if you are using a terminal with a transparent +background. + Status window colors:: Appearance of the bottom window showing info messages. @@ -332,9 +343,6 @@ delimiting long author names and labels for tag and branch references. Highlighting ~~~~~~~~~~~~ -The colors and attributes for text that is not highlighted can be controlled -by changing the *default* color option. - -- Diff markup:: -- 2.30.2