aboutsummaryrefslogtreecommitdiffstats
path: root/src/vppinfra/format_table.c
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2022-04-08 13:42:41 +0200
committerDamjan Marion <damarion@cisco.com>2022-04-08 15:24:28 +0200
commit853530b528d57506236c6e2b5ffc02fc976cdc68 (patch)
tree3005c9ae1fb5480d482516c2e6d096e5374c3b70 /src/vppinfra/format_table.c
parentba2f55154c4ae91a98348ac48a0d11f0de9772db (diff)
vppinfra: add bright colors to format_table
Type: improvement Change-Id: I21de21af6dea9e39df5e912e20e56d878a40659f Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vppinfra/format_table.c')
-rw-r--r--src/vppinfra/format_table.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/vppinfra/format_table.c b/src/vppinfra/format_table.c
index 8b218f5f2e1..5fe7521af86 100644
--- a/src/vppinfra/format_table.c
+++ b/src/vppinfra/format_table.c
@@ -64,12 +64,14 @@ format_text_cell (table_t *t, u8 *s, table_cell_t *c, table_text_attr_t *def,
{
a->fg_color = c->attr.fg_color;
a->flags |= TTAF_FG_COLOR_SET;
+ a->flags |= c->attr.flags & TTAF_FG_COLOR_BRIGHT;
}
if (c->attr.flags & TTAF_BG_COLOR_SET)
{
a->bg_color = c->attr.bg_color;
a->flags |= TTAF_BG_COLOR_SET;
+ a->flags |= c->attr.flags & TTAF_BG_COLOR_BRIGHT;
}
if (a->flags & TTAF_RESET)
@@ -216,16 +218,24 @@ void
table_set_cell_fg_color (table_t *t, int c, int r, table_text_attr_color_t v)
{
table_cell_t *cell = table_get_cell (t, c, r);
- cell->attr.fg_color = v;
+ cell->attr.fg_color = v & 0x7;
cell->attr.flags |= TTAF_FG_COLOR_SET;
+ if (v & 8)
+ cell->attr.flags |= TTAF_FG_COLOR_BRIGHT;
+ else
+ cell->attr.flags &= ~TTAF_FG_COLOR_BRIGHT;
}
void
table_set_cell_bg_color (table_t *t, int c, int r, table_text_attr_color_t v)
{
table_cell_t *cell = table_get_cell (t, c, r);
- cell->attr.bg_color = v;
+ cell->attr.bg_color = v & 0x7;
cell->attr.flags |= TTAF_BG_COLOR_SET;
+ if (v & 8)
+ cell->attr.flags |= TTAF_BG_COLOR_BRIGHT;
+ else
+ cell->attr.flags &= ~TTAF_BG_COLOR_BRIGHT;
}
void