1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-03 00:03:12 +02:00

core: add new option weechat.look.color_basic_force_bold, off by default: bold is used only if terminal has less than 16 colors (patch #7621)

This commit is contained in:
Sebastien Helleu
2011-09-24 11:28:33 +02:00
parent 7998e60498
commit fb5d40951c
19 changed files with 147 additions and 32 deletions
+8
View File
@@ -85,6 +85,7 @@ struct t_config_option *config_look_bar_more_up;
struct t_config_option *config_look_bar_more_down;
struct t_config_option *config_look_buffer_notify_default;
struct t_config_option *config_look_buffer_time_format;
struct t_config_option *config_look_color_basic_force_bold;
struct t_config_option *config_look_color_inactive_window;
struct t_config_option *config_look_color_inactive_buffer;
struct t_config_option *config_look_color_inactive_time;
@@ -1653,6 +1654,13 @@ config_weechat_init_options ()
"\"${color}\", for example french time: "
"\"${lightblue}%H${white}%M${lightred}%S\""),
NULL, 0, 0, "%H:%M:%S", NULL, 0, NULL, NULL, &config_change_buffer_time_format, NULL, NULL, NULL);
config_look_color_basic_force_bold = config_file_new_option (
weechat_config_file, ptr_section,
"color_basic_force_bold", "boolean",
N_("force \"bold\" attribute for light colors and \"darkgray\" in "
"basic colors; off by default: \"bold\" is used only if terminal "
"has less than 16 colors"),
NULL, 0, 0, "off", NULL, 0, NULL, NULL, &config_change_color, NULL, NULL, NULL);
config_look_color_inactive_window = config_file_new_option (
weechat_config_file, ptr_section,
"color_inactive_window", "boolean",
+1
View File
@@ -112,6 +112,7 @@ extern struct t_config_option *config_look_buffer_notify_default;
extern struct t_config_option *config_look_buffer_time_format;
extern struct t_config_option *config_look_command_chars;
extern struct t_config_option *config_look_confirm_quit;
extern struct t_config_option *config_look_color_basic_force_bold;
extern struct t_config_option *config_look_color_inactive_window;
extern struct t_config_option *config_look_color_inactive_buffer;
extern struct t_config_option *config_look_color_inactive_time;
+50 -19
View File
@@ -47,26 +47,47 @@
#define GUI_COLOR_TIMER_TERM_COLORS 10
struct t_gui_color gui_weechat_colors[GUI_CURSES_NUM_WEECHAT_COLORS + 1] =
{ { -1, -1, 0, "default" },
{ COLOR_BLACK, COLOR_BLACK, 0, "black" },
{ COLOR_BLACK, COLOR_BLACK + 8, A_BOLD, "darkgray" },
{ COLOR_RED, COLOR_RED, 0, "red" },
{ COLOR_RED, COLOR_RED + 8, A_BOLD, "lightred" },
{ COLOR_GREEN, COLOR_GREEN, 0, "green" },
{ COLOR_GREEN, COLOR_GREEN + 8, A_BOLD, "lightgreen" },
{ COLOR_YELLOW, COLOR_YELLOW, 0, "brown" },
{ COLOR_YELLOW, COLOR_YELLOW + 8, A_BOLD, "yellow" },
{ COLOR_BLUE, COLOR_BLUE, 0, "blue" },
{ COLOR_BLUE, COLOR_BLUE + 8, A_BOLD, "lightblue" },
{ COLOR_MAGENTA, COLOR_MAGENTA, 0, "magenta" },
{ COLOR_MAGENTA, COLOR_MAGENTA + 8, A_BOLD, "lightmagenta" },
{ COLOR_CYAN, COLOR_CYAN, 0, "cyan" },
{ COLOR_CYAN, COLOR_CYAN + 8, A_BOLD, "lightcyan" },
{ COLOR_WHITE, COLOR_WHITE, 0, "gray" },
{ COLOR_WHITE, COLOR_WHITE + 8, A_BOLD, "white" },
{ 0, 0, 0, NULL }
struct t_gui_color gui_weechat_colors_bold[GUI_CURSES_NUM_WEECHAT_COLORS + 1] =
{ { -1, -1, 0, "default" },
{ COLOR_BLACK, COLOR_BLACK, 0, "black" },
{ COLOR_BLACK, COLOR_BLACK + 8, A_BOLD, "darkgray" },
{ COLOR_RED, COLOR_RED, 0, "red" },
{ COLOR_RED, COLOR_RED + 8, A_BOLD, "lightred" },
{ COLOR_GREEN, COLOR_GREEN, 0, "green" },
{ COLOR_GREEN, COLOR_GREEN + 8, A_BOLD, "lightgreen" },
{ COLOR_YELLOW, COLOR_YELLOW, 0, "brown" },
{ COLOR_YELLOW, COLOR_YELLOW + 8, A_BOLD, "yellow" },
{ COLOR_BLUE, COLOR_BLUE, 0, "blue" },
{ COLOR_BLUE, COLOR_BLUE + 8, A_BOLD, "lightblue" },
{ COLOR_MAGENTA, COLOR_MAGENTA, 0, "magenta" },
{ COLOR_MAGENTA, COLOR_MAGENTA + 8, A_BOLD, "lightmagenta" },
{ COLOR_CYAN, COLOR_CYAN, 0, "cyan" },
{ COLOR_CYAN, COLOR_CYAN + 8, A_BOLD, "lightcyan" },
{ COLOR_WHITE, COLOR_WHITE, 0, "gray" },
{ COLOR_WHITE, COLOR_WHITE + 8, A_BOLD, "white" },
{ 0, 0, 0, NULL }
};
struct t_gui_color gui_weechat_colors_no_bold[GUI_CURSES_NUM_WEECHAT_COLORS + 1] =
{ { -1, -1, 0, "default" },
{ COLOR_BLACK, COLOR_BLACK, 0, "black" },
{ COLOR_BLACK + 8, COLOR_BLACK + 8, 0, "darkgray" },
{ COLOR_RED, COLOR_RED, 0, "red" },
{ COLOR_RED + 8, COLOR_RED + 8, 0, "lightred" },
{ COLOR_GREEN, COLOR_GREEN, 0, "green" },
{ COLOR_GREEN + 8, COLOR_GREEN + 8, 0, "lightgreen" },
{ COLOR_YELLOW, COLOR_YELLOW, 0, "brown" },
{ COLOR_YELLOW + 8, COLOR_YELLOW + 8, 0, "yellow" },
{ COLOR_BLUE, COLOR_BLUE, 0, "blue" },
{ COLOR_BLUE + 8, COLOR_BLUE + 8, 0, "lightblue" },
{ COLOR_MAGENTA, COLOR_MAGENTA, 0, "magenta" },
{ COLOR_MAGENTA + 8, COLOR_MAGENTA + 8, 0, "lightmagenta" },
{ COLOR_CYAN, COLOR_CYAN, 0, "cyan" },
{ COLOR_CYAN + 8, COLOR_CYAN + 8, 0, "lightcyan" },
{ COLOR_WHITE, COLOR_WHITE, 0, "gray" },
{ COLOR_WHITE + 8, COLOR_WHITE + 8, 0, "white" },
{ 0, 0, 0, NULL }
};
struct t_gui_color *gui_weechat_colors = gui_weechat_colors_bold;
/* terminal colors */
int gui_color_term_has_colors = 0; /* terminal supports colors? */
@@ -1356,6 +1377,16 @@ gui_color_palette_free (struct t_gui_color_palette *color_palette)
void
gui_color_init_weechat ()
{
if (CONFIG_BOOLEAN(config_look_color_basic_force_bold)
|| (gui_color_term_colors < 16))
{
gui_weechat_colors = gui_weechat_colors_bold;
}
else
{
gui_weechat_colors = gui_weechat_colors_no_bold;
}
gui_color_build (GUI_COLOR_SEPARATOR, CONFIG_COLOR(config_color_separator), CONFIG_COLOR(config_color_chat_bg));
gui_color_build (GUI_COLOR_CHAT, CONFIG_COLOR(config_color_chat), CONFIG_COLOR(config_color_chat_bg));
+1 -1
View File
@@ -58,7 +58,7 @@ struct t_gui_bar_window_curses_objects
};
extern int gui_term_cols, gui_term_lines;
extern struct t_gui_color gui_weechat_colors[];
extern struct t_gui_color *gui_weechat_colors;
extern int gui_color_term_colors;
extern int gui_color_num_pairs;
extern int gui_color_pairs_auto_reset;