From fc95e7551a2f4e099c68fed6b14025adb8110673 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Fri, 25 Apr 2014 00:55:10 -0400 Subject: colors --- src/screen.c | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/src/screen.c b/src/screen.c index 98236a8..7f89916 100644 --- a/src/screen.c +++ b/src/screen.c @@ -64,6 +64,8 @@ void runes_screen_show_string_ascii(RunesTerm *t, char *buf, size_t len) cell->len = 1; cell->contents[0] = buf[i]; cell->contents[1] = '\0'; + cell->fgcolor = scr->fgcolor; + cell->bgcolor = scr->bgcolor; scr->cur.col++; } @@ -87,6 +89,8 @@ void runes_screen_show_string_utf8(RunesTerm *t, char *buf, size_t len) cell->len = next - c; strncpy(cell->contents, c, cell->len); + cell->fgcolor = scr->fgcolor; + cell->bgcolor = scr->bgcolor; scr->cur.col++; c = next; @@ -211,15 +215,16 @@ void runes_screen_set_scroll_region( void runes_screen_reset_text_attributes(RunesTerm *t) { - UNUSED(t); - fprintf(stderr, "reset_text_attributes nyi\n"); + runes_screen_reset_fg_color(t); + runes_screen_reset_bg_color(t); } void runes_screen_set_fg_color(RunesTerm *t, int idx) { - UNUSED(t); - UNUSED(idx); - fprintf(stderr, "set_fg_color nyi\n"); + RunesScreen *scr = &t->scr; + + scr->fgcolor.type = RUNES_COLOR_IDX; + scr->fgcolor.idx = idx; } void runes_screen_set_fg_color_rgb(RunesTerm *t, int r, int g, int b) @@ -233,15 +238,17 @@ void runes_screen_set_fg_color_rgb(RunesTerm *t, int r, int g, int b) void runes_screen_reset_fg_color(RunesTerm *t) { - UNUSED(t); - fprintf(stderr, "reset_fg_color nyi\n"); + RunesScreen *scr = &t->scr; + + scr->fgcolor.type = RUNES_COLOR_DEFAULT; } void runes_screen_set_bg_color(RunesTerm *t, int idx) { - UNUSED(t); - UNUSED(idx); - fprintf(stderr, "set_bg_color nyi\n"); + RunesScreen *scr = &t->scr; + + scr->bgcolor.type = RUNES_COLOR_IDX; + scr->bgcolor.idx = idx; } void runes_screen_set_bg_color_rgb(RunesTerm *t, int r, int g, int b) @@ -255,8 +262,9 @@ void runes_screen_set_bg_color_rgb(RunesTerm *t, int r, int g, int b) void runes_screen_reset_bg_color(RunesTerm *t) { - UNUSED(t); - fprintf(stderr, "reset_bg_color nyi\n"); + RunesScreen *scr = &t->scr; + + scr->bgcolor.type = RUNES_COLOR_DEFAULT; } void runes_screen_set_bold(RunesTerm *t) -- cgit v1.2.3