Some colour fixes and tweaks (marked pane, cursor colours now work).

This commit is contained in:
nicm
2026-06-26 11:36:22 +00:00
parent 19db019e0c
commit 73fd01c986
7 changed files with 38 additions and 11 deletions

View File

@@ -832,6 +832,7 @@ mode_tree_draw(struct mode_tree_data *mtd)
const char *tag, *separator;
size_t n;
int keylen, alignlen[mtd->maxdepth + 1];
int dfg, dfg0;
if (mtd->line_size == 0)
return;
@@ -842,6 +843,9 @@ mode_tree_draw(struct mode_tree_data *mtd)
memcpy(&box_gc, &grid_default_cell, sizeof box_gc);
style_apply(&box_gc, oo, "tree-mode-border-style", NULL);
dfg = gc.fg;
dfg0 = gc0.fg;
w = mtd->width;
h = mtd->height;
@@ -927,8 +931,8 @@ mode_tree_draw(struct mode_tree_data *mtd)
width = prefix_width + text_width;
if (mti->tagged) {
gc.attr ^= GRID_ATTR_BRIGHT;
gc0.attr ^= GRID_ATTR_BRIGHT;
gc.fg = COLOUR_THEME_CYAN|COLOUR_FLAG_THEME;
gc0.fg = COLOUR_THEME_CYAN|COLOUR_FLAG_THEME;
}
if (i != mtd->current) {
@@ -965,8 +969,8 @@ mode_tree_draw(struct mode_tree_data *mtd)
free(prefix);
if (mti->tagged) {
gc.attr ^= GRID_ATTR_BRIGHT;
gc0.attr ^= GRID_ATTR_BRIGHT;
gc.fg = dfg;
gc0.fg = dfg0;
}
}
format_free(ft);

View File

@@ -274,6 +274,7 @@ const struct options_name_map options_other_names[] = {
{ "clock-mode-color", "clock-mode-colour" },
{ "cursor-color", "cursor-colour" },
{ "prompt-cursor-color", "prompt-cursor-colour" },
{ "prompt-command-cursor-color", "prompt-command-cursor-colour" },
{ "pane-colors", "pane-colours" },
{ NULL, NULL }
};
@@ -586,7 +587,7 @@ const struct options_table_entry options_table[] = {
.type = OPTIONS_TABLE_STRING,
.scope = OPTIONS_TABLE_SERVER,
.flags = OPTIONS_TABLE_IS_COLOUR,
.default_str = "#{?#{e|>=:#{client_colours},256},darkseagreen,green}",
.default_str = "#{?#{e|>=:#{client_colours},256},yellowgreen,green}",
.text = "Dark theme colour for green."
},
@@ -1173,6 +1174,15 @@ const struct options_table_entry options_table[] = {
.text = "Colour of the cursor when in the command prompt."
},
{ .name = "prompt-command-cursor-colour",
.type = OPTIONS_TABLE_STRING,
.scope = OPTIONS_TABLE_SESSION,
.flags = OPTIONS_TABLE_IS_COLOUR,
.default_str = "",
.text = "Colour of the cursor in the command prompt when in command "
"mode, if 'status-keys' is set to 'vi'."
},
{ .name = "prompt-cursor-style",
.type = OPTIONS_TABLE_CHOICE,
.scope = OPTIONS_TABLE_SESSION,

View File

@@ -45,6 +45,7 @@ struct prompt {
enum screen_cursor_style cstyle;
enum screen_cursor_style command_cstyle;
int ccolour;
int command_ccolour;
int cmode;
int command_cmode;
@@ -123,6 +124,8 @@ prompt_set_options(struct prompt_create_data *pd, struct session *s)
screen_set_cursor_style(n, &pd->command_cstyle, &pd->command_cmode);
style_apply(&gc, oo, "prompt-cursor-colour", NULL);
pd->ccolour = gc.fg;
style_apply(&gc, oo, "prompt-command-cursor-colour", NULL);
pd->command_ccolour = gc.fg;
pd->message_format = options_get_string(oo, "message-format");
pd->keys = options_get_number(oo, "status-keys");
pd->word_separators = options_get_string(oo, "word-separators");
@@ -177,6 +180,7 @@ prompt_create(const struct prompt_create_data *pd)
pr->cstyle = pd->cstyle;
pr->command_cstyle = pd->command_cstyle;
pr->ccolour = pd->ccolour;
pr->command_ccolour = pd->command_ccolour;
pr->cmode = pd->cmode;
pr->command_cmode = pd->command_cmode;
pr->message_format = xstrdup(pd->message_format);
@@ -466,12 +470,13 @@ prompt_draw(struct prompt *pr, struct prompt_draw_data *pd)
memcpy(&gc, &pr->command_style, sizeof gc);
s->default_cstyle = pr->command_cstyle;
s->default_mode = pr->command_cmode;
s->default_ccolour = pr->command_ccolour;
} else {
memcpy(&gc, &pr->style, sizeof gc);
s->default_cstyle = pr->cstyle;
s->default_mode = pr->cmode;
s->default_ccolour = pr->ccolour;
}
s->default_ccolour = pr->ccolour;
expanded = prompt_expand(pr);
start = format_width(expanded);

9
tmux.1
View File

@@ -5249,14 +5249,19 @@ is input before dismissing it.
Can be set to zero to disable any timeout.
.It Ic prompt\-cursor\-colour Ar colour
Set the colour of the cursor in the command prompt.
.It Ic prompt\-command\-cursor\-colour Ar colour
Set the colour of the cursor in the command prompt when
.Xr vi 1
keys are enabled and the prompt is in command mode.
.It Ic prompt\-cursor\-style Ar style
Set the style of the cursor in the command prompt.
See the
.Ic cursor\-style
options for available styles.
.It Ic prompt\-command\-cursor\-style Ar style
Set the style of the cursor in the command prompt when vi keys are enabled and
the prompt is in command mode.
Set the style of the cursor in the command prompt when
.Xr vi 1
keys are enabled and the prompt is in command mode.
See the
.Ic cursor\-style
options for available styles.

1
tmux.h
View File

@@ -2068,6 +2068,7 @@ struct prompt_create_data {
enum screen_cursor_style cstyle;
enum screen_cursor_style command_cstyle;
int ccolour;
int command_ccolour;
int cmode;
int command_cmode;
const char *message_format;

4
tty.c
View File

@@ -748,8 +748,10 @@ tty_force_cursor_colour(struct tty *tty, int c)
u_char r, g, b;
char s[13];
if (c != -1)
if (c != -1) {
c = tty_map_theme_colour(tty, c);
c = colour_force_rgb(c);
}
if (c == tty->ccolour)
return;
if (c == -1)

View File

@@ -38,11 +38,11 @@ static void window_tree_key(struct window_mode_entry *,
#define WINDOW_TREE_DEFAULT_FORMAT \
"#{?pane_format," \
"#{?pane_marked,#[reverse],}#{?pane_floating_flag,#[italics],}" \
"#{?pane_marked,#[fg=thememagenta],}#{?pane_floating_flag,#[underscore],}" \
"#{pane_current_command}#[fg=themelightgrey]#{pane_flags}" \
"#{?#{&&:#{pane_title},#{!=:#{pane_title},#{host_short}}},: \"#{pane_title}\",}" \
",window_format," \
"#{?window_marked_flag,#[reverse],}" \
"#{?window_marked_flag,#[fg=thememagenta],}" \
"#{window_name}#[fg=themelightgrey]#{window_flags}" \
"#{?#{&&:#{==:#{window_panes},1},#{&&:#{pane_title},#{!=:#{pane_title},#{host_short}}}},: \"#{pane_title}\",}" \
"," \