mirror of
https://github.com/tmux/tmux.git
synced 2026-10-11 13:04:22 +00:00
Expand colours as formats like styles.
This commit is contained in:
23
style.c
23
style.c
@@ -434,6 +434,29 @@ style_apply(struct grid_cell *gc, struct options *oo, const char *name,
|
||||
style_add(gc, oo, name, ft);
|
||||
}
|
||||
|
||||
/* Parse a single colour into a style */
|
||||
int
|
||||
style_parse_colour(struct style *sy, const struct grid_cell *base,
|
||||
const char *s)
|
||||
{
|
||||
int c;
|
||||
|
||||
style_set(sy, base);
|
||||
|
||||
if (*s == '\0') {
|
||||
sy->gc.fg = -1;
|
||||
return (0);
|
||||
}
|
||||
|
||||
if ((c = colour_fromstring(s)) == -1)
|
||||
return (-1);
|
||||
if (c == 8)
|
||||
sy->gc.fg = base->fg;
|
||||
else
|
||||
sy->gc.fg = c;
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* Initialize style from cell. */
|
||||
void
|
||||
style_set(struct style *sy, const struct grid_cell *gc)
|
||||
|
||||
Reference in New Issue
Block a user