aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2014-04-25 00:55:10 -0400
committerJesse Luehrs <doy@tozt.net>2014-04-25 00:55:10 -0400
commitfc95e7551a2f4e099c68fed6b14025adb8110673 (patch)
tree6c97287a8c18b0be348153347fbdcd155843672e
parent380ff5c7d4af746185026086a4fc5e9a97655465 (diff)
downloadrunes-fc95e7551a2f4e099c68fed6b14025adb8110673.tar.gz
runes-fc95e7551a2f4e099c68fed6b14025adb8110673.zip
colors
-rw-r--r--src/screen.c32
1 files 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)