diff options
| author | user <user@clank> | 2026-09-22 11:59:10 +0200 |
|---|---|---|
| committer | user <user@clank> | 2026-09-22 11:59:10 +0200 |
| commit | cb0d993fa284005d5679b628bb08d51f12812b8c (patch) | |
| tree | 9d28b86f925255a24adb27306c6dde62e9f86292 /src | |
| parent | sidebar: air between tabs (tab_gap) (diff) | |
| download | slosh-cb0d993fa284005d5679b628bb08d51f12812b8c.tar.gz slosh-cb0d993fa284005d5679b628bb08d51f12812b8c.tar.xz slosh-cb0d993fa284005d5679b628bb08d51f12812b8c.zip | |
tabs: a plate under the ones you are not in (tab_idle_bg)
The active tab has been filled with the accent since the strip existed; every
other tab was words on the background. That leaves the strip with one shape on
it and nothing to compare it against -- where a tab ends, how far the row you
are about to click reaches, and in the sidebar which rows are tabs rather than
statuses, all had to be read off the text.
tab_idle_bg fills them. Barely off the background and in the label's own grey,
because this is not a second highlight: it gives a tab edges, and it gives the
accent something to be brighter than, which on a strip of short labels is most
of how the eye finds the tab it is in. Hover keeps it for the same reason the
active tab keeps its fill -- losing the plate under the pointer would read as
the tab going away -- so hovering still lands on the text, and the bell mark
sits on the plate rather than punching a hole in it.
Derived a third of the way from default_bg to tab_idle when nobody names it,
the same bargain tab_status_fg and tab_status_stripe already make: both ends
are colours every theme in contrib defines, so each gets a plate in its own
family -- paper lightens, phosphor greens, mono stays grey -- without a line
added to any of them. Naming it wins, and naming your own background is how
you ask for the bare tabs back.
The `+ new tab` button and the gaps between tabs stay unpainted: the button is
the one row in the list that does not mean "go here", and tab_gap is air
between plates, which is what makes them read as separate tabs at all.
Diffstat (limited to 'src')
| -rw-r--r-- | src/app_draw.c | 27 | ||||
| -rw-r--r-- | src/config.c | 18 |
2 files changed, 34 insertions, 11 deletions
diff --git a/src/app_draw.c b/src/app_draw.c index a363143..a8b40f5 100644 --- a/src/app_draw.c +++ b/src/app_draw.c @@ -1868,13 +1868,20 @@ static uint16_t draw_tab_cell(app_t *a, screen_t *s, size_t i, uint16_t x, * hover colour if that width turns out to be under the pointer — which * costs a repaint of a few cells and guarantees the lit cells are the * registered ones. */ + /* Every tab is a plate: the active one in the accent, the rest in + * `tab_idle_bg`. The quiet fill is what makes a strip of labels read as + * tabs — where one ends and the next begins, and how far the row the + * pointer will hit actually extends — and it is what the active fill is + * brighter *than*. A theme that wants the old bare strip sets it to its own + * background. */ uint16_t w = screen_text( s, x, y, label, editing ? RENAME_FG : (active ? TAB_ACTIVE_FG : TAB_IDLE), - editing ? RENAME_BG : (active ? TAB_ACTIVE_BG : NO_COLOR), + editing ? RENAME_BG : (active ? TAB_ACTIVE_BG : TAB_IDLE_BG), editing ? ATTR_BOLD : attrs); - /* Hovering keeps the active tab's fill — it is still the tab you are in — - * so its feedback lands on the text instead. An inactive tab has no fill - * to keep, and brightens. */ + /* Hovering keeps the tab's own fill — the active one because it is still + * the tab you are in, an inactive one because losing its plate under the + * pointer would read as the tab going away — so the feedback lands on the + * text, which brightens. */ /* The bell keeps its own colour here too, rather than taking the tab's — * an indicator drawn in the same dim grey as the label it sits next to is * an indicator you have to already be looking for. */ @@ -1882,13 +1889,13 @@ static uint16_t draw_tab_cell(app_t *a, screen_t *s, size_t i, uint16_t x, char mark[24]; snprintf(mark, sizeof mark, "%s ", CFG.bell_mark); w = (uint16_t)(w + screen_text(s, (uint16_t)(x + w), y, mark, BELL_C, - active ? TAB_ACTIVE_BG : NO_COLOR, + active ? TAB_ACTIVE_BG : TAB_IDLE_BG, ATTR_BOLD)); } uint16_t hit_w = max_w ? max_w : w; if (!editing && ptr_on(a, x, y, hit_w, 1)) screen_text(s, x, y, label, active ? TAB_ACTIVE_HOVER_FG : TAB_HOVER, - active ? TAB_ACTIVE_BG : NO_COLOR, attrs | ATTR_BOLD); + active ? TAB_ACTIVE_BG : TAB_IDLE_BG, attrs | ATTR_BOLD); /* While a pane is in your hand, every tab it does not already live in is * somewhere it could go, and `ptr_on` says nothing during a drag by design -- @@ -2101,9 +2108,11 @@ static size_t wrap_cells(const char *text, uint16_t width, size_t max, len += clen; if (p[len] == ' ') brk = len; /* the last break point that still fits */ } - if (!p[len]) brk = len; /* what is left fits whole */ - else if (!brk) brk = len; /* one long word: split it rather than stall */ - if (!brk) break; /* not even one cell of room */ + if (!p[len]) + brk = len; /* what is left fits whole */ + else if (!brk) + brk = len; /* one long word: split it rather than stall */ + if (!brk) break; /* not even one cell of room */ if (brk >= STATUS_ROW_CAP) brk = STATUS_ROW_CAP - 1; memcpy(out[n], p, brk); out[n][brk] = 0; diff --git a/src/config.c b/src/config.c index b9e3c29..d729287 100644 --- a/src/config.c +++ b/src/config.c @@ -651,6 +651,7 @@ static const struct { {"tab_active_bg", offsetof(config_t, tab_active_bg)}, {"tab_active_hover_fg", offsetof(config_t, tab_active_hover_fg)}, {"tab_idle", offsetof(config_t, tab_idle)}, + {"tab_idle_bg", offsetof(config_t, tab_idle_bg)}, {"tab_hover", offsetof(config_t, tab_hover)}, {"prefix_fg", offsetof(config_t, prefix_fg)}, {"prefix_bg", offsetof(config_t, prefix_bg)}, @@ -1058,6 +1059,13 @@ void config_defaults(config_t *c) { c->tab_active_bg = accent; c->tab_active_hover_fg = bright; c->tab_idle = dim; + /* A plate under the tabs you are not in. Barely off the background and in + * the label's own grey: enough that a tab is a shape with edges, not enough + * to compete with the active tab's accent fill -- the strip has one + * highlight and this is not it. It also gives the active fill something to + * be brighter *than*, which on a strip of short labels is most of how the + * eye finds it. */ + c->tab_idle_bg = blend(c->default_bg, dim, 30); c->tab_hover = accent; c->prefix_fg = ink; c->prefix_bg = accent; @@ -2233,8 +2241,7 @@ static bool load_into(config_t *c, const char *path, int depth, char *err, c->tab_bar_width); c->tab_bar_pad = (uint16_t)kdl_arg_int(kdl_child(root, "tab_bar_pad"), 0, c->tab_bar_pad); - c->tab_gap = - (uint16_t)kdl_arg_int(kdl_child(root, "tab_gap"), 0, c->tab_gap); + c->tab_gap = (uint16_t)kdl_arg_int(kdl_child(root, "tab_gap"), 0, c->tab_gap); c->tab_bar_status = (uint16_t)kdl_arg_int(kdl_child(root, "tab_bar_status"), 0, c->tab_bar_status); c->tab_bar_status_lines = (uint16_t)kdl_arg_int( @@ -2486,6 +2493,13 @@ static bool load_into(config_t *c, const char *path, int depth, char *err, * split apply_scrolled makes. */ if (!kdl_child(theme, "tab_status_fg")) c->tab_status_fg = blend(c->tab_count, c->tab_hover, 40); + /* The idle tab plate, on the same terms: a third of the way from the + * theme's background to the grey it writes idle tab labels in. Every + * theme defines both, so each gets a plate in its own family -- paper + * lightens, phosphor greens -- and a theme that wants the bare strip back + * says `tab_idle_bg` in its own default_bg rather than editing this. */ + if (!kdl_child(theme, "tab_idle_bg")) + c->tab_idle_bg = blend(c->default_bg, c->tab_idle, 30); /* The alternate band, on the same terms. A tenth of the way from the * tab bar's own background toward the accent: enough to read as a * different row at a glance, not enough to read as a highlight. */ |
