From 2f7e182abd2f1598516d059288987813c8f7efb2 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Thu, 10 Sep 2009 17:16:25 +0000 Subject: Permit options such as status-bg to be configured using the entire 256 colour palette by setting "colour0" to "colour255". --- usr.bin/tmux/clock.c | 6 +++--- usr.bin/tmux/colour.c | 43 ++++++++++++++++++++++++++++++++++++++-- usr.bin/tmux/screen-redraw.c | 13 ++++++------ usr.bin/tmux/screen-write.c | 29 +++++++++++++++++++-------- usr.bin/tmux/server.c | 4 ++-- usr.bin/tmux/status.c | 47 ++++++++++++++++++++++---------------------- usr.bin/tmux/tmux.1 | 11 +++++++---- usr.bin/tmux/tmux.h | 6 ++++-- usr.bin/tmux/tty.c | 5 +++-- usr.bin/tmux/window-choose.c | 9 +++++---- usr.bin/tmux/window-copy.c | 16 ++++++++------- usr.bin/tmux/window-more.c | 9 +++++---- usr.bin/tmux/window-scroll.c | 9 +++++---- 13 files changed, 135 insertions(+), 72 deletions(-) diff --git a/usr.bin/tmux/clock.c b/usr.bin/tmux/clock.c index b455f82e606..4dec04bda32 100644 --- a/usr.bin/tmux/clock.c +++ b/usr.bin/tmux/clock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: clock.c,v 1.3 2009/08/26 16:23:30 nicm Exp $ */ +/* $OpenBSD: clock.c,v 1.4 2009/09/10 17:16:24 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott @@ -120,7 +120,7 @@ clock_draw(struct screen_write_ctx *ctx, u_int colour, int style) screen_write_cursormove(ctx, x, y); memcpy(&gc, &grid_default_cell, sizeof gc); - gc.fg = colour; + colour_set_fg(&gc, colour); screen_write_puts(ctx, &gc, "%s", tim); } return; @@ -130,7 +130,7 @@ clock_draw(struct screen_write_ctx *ctx, u_int colour, int style) y = (screen_size_y(s) / 2) - 3; memcpy(&gc, &grid_default_cell, sizeof gc); - gc.bg = colour; + colour_set_bg(&gc, colour); for (ptr = tim; *ptr != '\0'; ptr++) { if (*ptr >= '0' && *ptr <= '9') idx = *ptr - '0'; diff --git a/usr.bin/tmux/colour.c b/usr.bin/tmux/colour.c index 5b13db98760..288b35e3185 100644 --- a/usr.bin/tmux/colour.c +++ b/usr.bin/tmux/colour.c @@ -1,4 +1,4 @@ -/* $OpenBSD: colour.c,v 1.1 2009/06/01 22:58:49 nicm Exp $ */ +/* $OpenBSD: colour.c,v 1.2 2009/09/10 17:16:24 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott @@ -18,13 +18,42 @@ #include +#include #include #include "tmux.h" +/* + * Colour to string conversion functions. Bit 8 of the colour means it is one + * of the 256 colour palette. + */ + +void +colour_set_fg(struct grid_cell *gc, int c) +{ + if (c & 0x100) + gc->flags |= GRID_FLAG_FG256; + gc->fg = c; +} + +void +colour_set_bg(struct grid_cell *gc, int c) +{ + if (c & 0x100) + gc->flags |= GRID_FLAG_BG256; + gc->bg = c; +} + const char * -colour_tostring(u_char c) +colour_tostring(int c) { + static char s[32]; + + if (c & 0x100) { + xsnprintf(s, sizeof s, "colour%u", c & ~0x100); + return (s); + } + switch (c) { case 0: return ("black"); @@ -51,6 +80,16 @@ colour_tostring(u_char c) int colour_fromstring(const char *s) { + const char *errstr; + int n; + + if (strncasecmp(s, "colour", (sizeof "colour") - 1) == 0) { + n = strtonum(s + (sizeof "colour") - 1, 0, 255, &errstr); + if (errstr != NULL) + return (-1); + return (n | 0x100); + } + if (strcasecmp(s, "black") == 0 || (s[0] == '0' && s[1] == '\0')) return (0); if (strcasecmp(s, "red") == 0 || (s[0] == '1' && s[1] == '\0')) diff --git a/usr.bin/tmux/screen-redraw.c b/usr.bin/tmux/screen-redraw.c index 731d388199e..d3bdd6dc67b 100644 --- a/usr.bin/tmux/screen-redraw.c +++ b/usr.bin/tmux/screen-redraw.c @@ -1,4 +1,4 @@ -/* $OpenBSD: screen-redraw.c,v 1.10 2009/08/31 20:46:19 nicm Exp $ */ +/* $OpenBSD: screen-redraw.c,v 1.11 2009/09/10 17:16:24 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -240,7 +240,7 @@ screen_redraw_draw_number(struct client *c, struct window_pane *wp) struct session *s = c->session; struct grid_cell gc; u_int idx, px, py, i, j; - u_char colour; + int colour; char buf[16], *ptr; size_t len; @@ -256,7 +256,7 @@ screen_redraw_draw_number(struct client *c, struct window_pane *wp) if (wp->sx < len * 6 || wp->sy < 5) { tty_cursor(tty, px - len / 2, py, wp->xoff, wp->yoff); memcpy(&gc, &grid_default_cell, sizeof gc); - gc.fg = colour; + colour_set_fg(&gc, colour); tty_attributes(tty, &gc); tty_puts(tty, buf); return; @@ -266,7 +266,7 @@ screen_redraw_draw_number(struct client *c, struct window_pane *wp) py -= 2; memcpy(&gc, &grid_default_cell, sizeof gc); - gc.bg = colour; + colour_set_bg(&gc, colour); tty_attributes(tty, &gc); for (ptr = buf; *ptr != '\0'; ptr++) { if (*ptr < '0' || *ptr > '9') @@ -276,9 +276,8 @@ screen_redraw_draw_number(struct client *c, struct window_pane *wp) for (j = 0; j < 5; j++) { for (i = px; i < px + 5; i++) { tty_cursor(tty, i, py + j, wp->xoff, wp->yoff); - if (!clock_table[idx][j][i - px]) - continue; - tty_putc(tty, ' '); + if (clock_table[idx][j][i - px]) + tty_putc(tty, ' '); } } px += 6; diff --git a/usr.bin/tmux/screen-write.c b/usr.bin/tmux/screen-write.c index 233a93fe306..c04e596e9ef 100644 --- a/usr.bin/tmux/screen-write.c +++ b/usr.bin/tmux/screen-write.c @@ -1,4 +1,4 @@ -/* $OpenBSD: screen-write.c,v 1.24 2009/09/07 10:49:32 nicm Exp $ */ +/* $OpenBSD: screen-write.c,v 1.25 2009/09/10 17:16:24 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -300,7 +300,7 @@ screen_write_parsestyle( char tmp[32]; int val; size_t end; - u_char fg, bg, attr; + u_char fg, bg, attr, flags; if (*in == '\0') return; @@ -309,7 +309,8 @@ screen_write_parsestyle( fg = gc->fg; bg = gc->bg; - attr = 0; + attr = gc->attr; + flags = gc->flags; do { end = strcspn(in, delimiters); if (end > (sizeof tmp) - 1) @@ -325,14 +326,24 @@ screen_write_parsestyle( if ((val = colour_fromstring(tmp + 3)) == -1) return; if (*in == 'f' || *in == 'F') { - if (val != 8) + if (val != 8) { + if (val & 0x100) { + flags |= GRID_FLAG_FG256; + val &= ~0x100; + } else + flags &= ~GRID_FLAG_FG256; fg = val; - else + } else fg = defgc->fg; } else if (*in == 'b' || *in == 'B') { - if (val != 8) + if (val != 8) { + if (val & 0x100) { + flags |= GRID_FLAG_BG256; + val &= ~0x100; + } else + flags &= ~GRID_FLAG_BG256; bg = val; - else + } else bg = defgc->bg; } else return; @@ -347,6 +358,7 @@ screen_write_parsestyle( gc->fg = fg; gc->bg = bg; gc->attr = attr; + gc->flags = flags; } /* Copy from another screen. */ @@ -1002,7 +1014,8 @@ screen_write_cell( if (screen_check_selection(s, s->cx - width, s->cy)) { memcpy(&tmp_gc2, &s->sel.cell, sizeof tmp_gc2); tmp_gc2.data = gc->data; - tmp_gc2.flags = gc->flags; + tmp_gc2.flags = gc->flags & ~(GRID_FLAG_FG256|GRID_FLAG_BG256); + tmp_gc2.flags |= s->sel.cell.flags & (GRID_FLAG_FG256|GRID_FLAG_BG256); ttyctx.cell = &tmp_gc2; tty_write(tty_cmd_cell, &ttyctx); } else { diff --git a/usr.bin/tmux/server.c b/usr.bin/tmux/server.c index e8ea7435cc0..f0bfcc20dbe 100644 --- a/usr.bin/tmux/server.c +++ b/usr.bin/tmux/server.c @@ -1,4 +1,4 @@ -/* $OpenBSD: server.c,v 1.32 2009/09/07 21:12:12 nicm Exp $ */ +/* $OpenBSD: server.c,v 1.33 2009/09/10 17:16:24 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -601,7 +601,7 @@ server_redraw_locked(struct client *c) style = options_get_number(&global_w_options, "clock-mode-style"); memcpy(&gc, &grid_default_cell, sizeof gc); - gc.fg = colour; + colour_set_fg(&gc, colour); gc.attr |= GRID_ATTR_BRIGHT; screen_init(&screen, xx, yy, 0); diff --git a/usr.bin/tmux/status.c b/usr.bin/tmux/status.c index 18f244fea13..0bae3f40e77 100644 --- a/usr.bin/tmux/status.c +++ b/usr.bin/tmux/status.c @@ -1,4 +1,4 @@ -/* $OpenBSD: status.c,v 1.32 2009/09/07 18:50:45 nicm Exp $ */ +/* $OpenBSD: status.c,v 1.33 2009/09/10 17:16:24 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -66,8 +66,8 @@ status_redraw(struct client *c) if (gettimeofday(&c->status_timer, NULL) != 0) fatal("gettimeofday"); memcpy(&stdgc, &grid_default_cell, sizeof gc); - stdgc.fg = options_get_number(&s->options, "status-fg"); - stdgc.bg = options_get_number(&s->options, "status-bg"); + colour_set_fg(&stdgc, options_get_number(&s->options, "status-fg")); + colour_set_bg(&stdgc, options_get_number(&s->options, "status-bg")); stdgc.attr |= options_get_number(&s->options, "status-attr"); /* @@ -79,19 +79,19 @@ status_redraw(struct client *c) memcpy(&sr_stdgc, &stdgc, sizeof sr_stdgc); sl_fg = options_get_number(&s->options, "status-left-fg"); if (sl_fg != 8) - sl_stdgc.fg = sl_fg; + colour_set_fg(&sl_stdgc, sl_fg); sl_bg = options_get_number(&s->options, "status-left-bg"); if (sl_bg != 8) - sl_stdgc.bg = sl_bg; + colour_set_bg(&sl_stdgc, sl_bg); sl_attr = options_get_number(&s->options, "status-left-attr"); if (sl_attr != 0) sl_stdgc.attr = sl_attr; sr_fg = options_get_number(&s->options, "status-right-fg"); if (sr_fg != 8) - sr_stdgc.fg = sr_fg; + colour_set_fg(&sr_stdgc, sr_fg); sr_bg = options_get_number(&s->options, "status-right-bg"); if (sr_bg != 8) - sr_stdgc.bg = sr_bg; + colour_set_bg(&sr_stdgc, sr_bg); sr_attr = options_get_number(&s->options, "status-right-attr"); if (sr_attr != 0) sr_stdgc.attr = sr_attr; @@ -501,16 +501,17 @@ status_width(struct winlink *wl) char * status_print(struct session *s, struct winlink *wl, struct grid_cell *gc) { - char *text, flag; - u_char fg, bg, attr; + struct options *oo = &wl->window->options; + char *text, flag; + u_char fg, bg, attr; - fg = options_get_number(&wl->window->options, "window-status-fg"); + fg = options_get_number(oo, "window-status-fg"); if (fg != 8) - gc->fg = fg; - bg = options_get_number(&wl->window->options, "window-status-bg"); + colour_set_fg(gc, fg); + bg = options_get_number(oo, "window-status-bg"); if (bg != 8) - gc->bg = bg; - attr = options_get_number(&wl->window->options, "window-status-attr"); + colour_set_bg(gc, bg); + attr = options_get_number(oo, "window-status-attr"); if (attr != 0) gc->attr = attr; @@ -518,13 +519,13 @@ status_print(struct session *s, struct winlink *wl, struct grid_cell *gc) if (wl == SLIST_FIRST(&s->lastw)) flag = '-'; if (wl == s->curw) { - fg = options_get_number(&wl->window->options, "window-status-current-fg"); + fg = options_get_number(oo, "window-status-current-fg"); if (fg != 8) - gc->fg = fg; - bg = options_get_number(&wl->window->options, "window-status-current-bg"); + colour_set_fg(gc, fg); + bg = options_get_number(oo, "window-status-current-bg"); if (bg != 8) - gc->bg = bg; - attr = options_get_number(&wl->window->options, "window-status-current-attr"); + colour_set_bg(gc, bg); + attr = options_get_number(oo, "window-status-current-attr"); if (attr != 0) gc->attr = attr; flag = '*'; @@ -606,8 +607,8 @@ status_message_redraw(struct client *c) len = c->tty.sx; memcpy(&gc, &grid_default_cell, sizeof gc); - gc.fg = options_get_number(&s->options, "message-fg"); - gc.bg = options_get_number(&s->options, "message-bg"); + colour_set_fg(&gc, options_get_number(&s->options, "message-fg")); + colour_set_bg(&gc, options_get_number(&s->options, "message-bg")); gc.attr |= options_get_number(&s->options, "message-attr"); screen_write_start(&ctx, NULL, &c->status); @@ -719,8 +720,8 @@ status_prompt_redraw(struct client *c) len = c->tty.sx; memcpy(&gc, &grid_default_cell, sizeof gc); - gc.fg = options_get_number(&s->options, "message-fg"); - gc.bg = options_get_number(&s->options, "message-bg"); + colour_set_fg(&gc, options_get_number(&s->options, "message-fg")); + colour_set_bg(&gc, options_get_number(&s->options, "message-bg")); gc.attr |= options_get_number(&s->options, "message-attr"); screen_write_start(&ctx, NULL, &c->status); diff --git a/usr.bin/tmux/tmux.1 b/usr.bin/tmux/tmux.1 index f1c03047c05..3ad8712a880 100644 --- a/usr.bin/tmux/tmux.1 +++ b/usr.bin/tmux/tmux.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: tmux.1,v 1.84 2009/09/07 21:12:12 nicm Exp $ +.\" $OpenBSD: tmux.1,v 1.85 2009/09/10 17:16:24 nicm Exp $ .\" .\" Copyright (c) 2007 Nicholas Marriott .\" @@ -14,7 +14,7 @@ .\" IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING .\" OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: September 7 2009 $ +.Dd $Mdocdate: September 10 2009 $ .Dt TMUX 1 .Os .Sh NAME @@ -1250,8 +1250,11 @@ is one of: .Ic blue , .Ic magenta , .Ic cyan , -.Ic white -or +.Ic white , +.Ic colour0 +to +.Ic colour255 +from the 256-colour palette, or .Ic default . .It Ic message-fg Ar colour Set status line message foreground colour. diff --git a/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h index 8d4b10cc85d..06152be4145 100644 --- a/usr.bin/tmux/tmux.h +++ b/usr.bin/tmux/tmux.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tmux.h,v 1.101 2009/09/07 21:01:50 nicm Exp $ */ +/* $OpenBSD: tmux.h,v 1.102 2009/09/10 17:16:24 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -1486,7 +1486,9 @@ void input_key(struct window_pane *, int); void input_mouse(struct window_pane *, u_char, u_char, u_char); /* colour.c */ -const char *colour_tostring(u_char); +void colour_set_fg(struct grid_cell *, int); +void colour_set_bg(struct grid_cell *, int); +const char *colour_tostring(int); int colour_fromstring(const char *); u_char colour_256to16(u_char); u_char colour_256to88(u_char); diff --git a/usr.bin/tmux/tty.c b/usr.bin/tmux/tty.c index 9c4a16e99c4..755f4c9da5c 100644 --- a/usr.bin/tmux/tty.c +++ b/usr.bin/tmux/tty.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty.c,v 1.27 2009/08/31 20:46:19 nicm Exp $ */ +/* $OpenBSD: tty.c,v 1.28 2009/09/10 17:16:24 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -512,7 +512,8 @@ tty_draw_line(struct tty *tty, struct screen *s, u_int py, u_int ox, u_int oy) if (screen_check_selection(s, i, py)) { memcpy(&tmpgc, &s->sel.cell, sizeof tmpgc); tmpgc.data = gc->data; - tmpgc.flags = gc->flags; + tmpgc.flags = gc->flags & ~(GRID_FLAG_FG256|GRID_FLAG_BG256); + tmpgc.flags |= s->sel.cell.flags & (GRID_FLAG_FG256|GRID_FLAG_BG256); tty_cell(tty, &tmpgc, gu); } else tty_cell(tty, gc, gu); diff --git a/usr.bin/tmux/window-choose.c b/usr.bin/tmux/window-choose.c index d053556b1b7..45db4eec550 100644 --- a/usr.bin/tmux/window-choose.c +++ b/usr.bin/tmux/window-choose.c @@ -1,4 +1,4 @@ -/* $OpenBSD: window-choose.c,v 1.8 2009/08/05 16:26:38 nicm Exp $ */ +/* $OpenBSD: window-choose.c,v 1.9 2009/09/10 17:16:24 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott @@ -295,6 +295,7 @@ window_choose_write_line( { struct window_choose_mode_data *data = wp->modedata; struct window_choose_mode_item *item; + struct options *oo = &wp->window->options; struct screen *s = &data->screen; struct grid_cell gc; int utf8flag; @@ -305,9 +306,9 @@ window_choose_write_line( utf8flag = options_get_number(&wp->window->options, "utf8"); memcpy(&gc, &grid_default_cell, sizeof gc); if (data->selected == data->top + py) { - gc.fg = options_get_number(&wp->window->options, "mode-fg"); - gc.bg = options_get_number(&wp->window->options, "mode-bg"); - gc.attr |= options_get_number(&wp->window->options, "mode-attr"); + colour_set_fg(&gc, options_get_number(oo, "mode-fg")); + colour_set_bg(&gc, options_get_number(oo, "mode-bg")); + gc.attr |= options_get_number(oo, "mode-attr"); } screen_write_cursormove(ctx, 0, py); diff --git a/usr.bin/tmux/window-copy.c b/usr.bin/tmux/window-copy.c index 672b953195c..ec0a5966ef2 100644 --- a/usr.bin/tmux/window-copy.c +++ b/usr.bin/tmux/window-copy.c @@ -1,4 +1,4 @@ -/* $OpenBSD: window-copy.c,v 1.26 2009/09/07 18:50:45 nicm Exp $ */ +/* $OpenBSD: window-copy.c,v 1.27 2009/09/10 17:16:24 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -660,14 +660,15 @@ window_copy_write_line( { struct window_copy_mode_data *data = wp->modedata; struct screen *s = &data->screen; + struct options *oo = &wp->window->options; struct grid_cell gc; char hdr[32]; size_t last, xoff = 0, size = 0; memcpy(&gc, &grid_default_cell, sizeof gc); - gc.fg = options_get_number(&wp->window->options, "mode-fg"); - gc.bg = options_get_number(&wp->window->options, "mode-bg"); - gc.attr |= options_get_number(&wp->window->options, "mode-attr"); + colour_set_fg(&gc, options_get_number(oo, "mode-fg")); + colour_set_bg(&gc, options_get_number(oo, "mode-bg")); + gc.attr |= options_get_number(oo, "mode-attr"); last = screen_size_y(s) - 1; if (py == 0) { @@ -765,6 +766,7 @@ window_copy_update_selection(struct window_pane *wp) { struct window_copy_mode_data *data = wp->modedata; struct screen *s = &data->screen; + struct options *oo = &wp->window->options; struct grid_cell gc; u_int sx, sy, ty; @@ -773,9 +775,9 @@ window_copy_update_selection(struct window_pane *wp) /* Set colours. */ memcpy(&gc, &grid_default_cell, sizeof gc); - gc.fg = options_get_number(&wp->window->options, "mode-fg"); - gc.bg = options_get_number(&wp->window->options, "mode-bg"); - gc.attr |= options_get_number(&wp->window->options, "mode-attr"); + colour_set_fg(&gc, options_get_number(oo, "mode-fg")); + colour_set_bg(&gc, options_get_number(oo, "mode-bg")); + gc.attr |= options_get_number(oo, "mode-attr"); /* Find top of screen. */ ty = screen_hsize(&wp->base) - data->oy; diff --git a/usr.bin/tmux/window-more.c b/usr.bin/tmux/window-more.c index bcb5a7b2894..3581658e902 100644 --- a/usr.bin/tmux/window-more.c +++ b/usr.bin/tmux/window-more.c @@ -1,4 +1,4 @@ -/* $OpenBSD: window-more.c,v 1.8 2009/08/18 11:53:03 nicm Exp $ */ +/* $OpenBSD: window-more.c,v 1.9 2009/09/10 17:16:24 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -164,6 +164,7 @@ window_more_write_line( { struct window_more_mode_data *data = wp->modedata; struct screen *s = &data->screen; + struct options *oo = &wp->window->options; struct grid_cell gc; char *msg, hdr[32]; size_t size; @@ -176,9 +177,9 @@ window_more_write_line( size = xsnprintf(hdr, sizeof hdr, "[%u/%u]", data->top, ARRAY_LENGTH(&data->list)); screen_write_cursormove(ctx, screen_size_x(s) - size, 0); - gc.fg = options_get_number(&wp->window->options, "mode-fg"); - gc.bg = options_get_number(&wp->window->options, "mode-bg"); - gc.attr |= options_get_number(&wp->window->options, "mode-attr"); + colour_set_fg(&gc, options_get_number(oo, "mode-fg")); + colour_set_bg(&gc, options_get_number(oo, "mode-bg")); + gc.attr |= options_get_number(oo, "mode-attr"); screen_write_puts(ctx, &gc, "%s", hdr); memcpy(&gc, &grid_default_cell, sizeof gc); } else diff --git a/usr.bin/tmux/window-scroll.c b/usr.bin/tmux/window-scroll.c index e1ff8b76a10..3fb522666e6 100644 --- a/usr.bin/tmux/window-scroll.c +++ b/usr.bin/tmux/window-scroll.c @@ -1,4 +1,4 @@ -/* $OpenBSD: window-scroll.c,v 1.8 2009/08/13 22:32:18 nicm Exp $ */ +/* $OpenBSD: window-scroll.c,v 1.9 2009/09/10 17:16:24 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -192,6 +192,7 @@ window_scroll_write_line( { struct window_scroll_mode_data *data = wp->modedata; struct screen *s = &data->screen; + struct options *oo = &wp->window->options; struct grid_cell gc; char hdr[32]; size_t size; @@ -200,9 +201,9 @@ window_scroll_write_line( memcpy(&gc, &grid_default_cell, sizeof gc); size = xsnprintf(hdr, sizeof hdr, "[%u,%u/%u]", data->ox, data->oy, screen_hsize(&wp->base)); - gc.fg = options_get_number(&wp->window->options, "mode-fg"); - gc.bg = options_get_number(&wp->window->options, "mode-bg"); - gc.attr |= options_get_number(&wp->window->options, "mode-attr"); + colour_set_fg(&gc, options_get_number(oo, "mode-fg")); + colour_set_bg(&gc, options_get_number(oo, "mode-bg")); + gc.attr |= options_get_number(oo, "mode-attr"); screen_write_cursormove(ctx, screen_size_x(s) - size, 0); screen_write_puts(ctx, &gc, "%s", hdr); memcpy(&gc, &grid_default_cell, sizeof gc); -- cgit v1.2.3