From 251daaa806397817a2a5e1779a06222c09c99296 Mon Sep 17 00:00:00 2001 From: Jonas Gunz Date: Fri, 12 Jul 2019 13:22:25 +0200 Subject: Added whitespace mode --- src/color.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/color.c') diff --git a/src/color.c b/src/color.c index d822d56..b4f4a40 100644 --- a/src/color.c +++ b/src/color.c @@ -72,3 +72,12 @@ char* calc_col_ansi(uint8_t R, uint8_t G, uint8_t B) return c; } +char* calc_bg_col_ansi(uint8_t R, uint8_t G, uint8_t B) +{ + int num = 36 * (R/51) + 6 * (G/51) + (B/51); + char *c = malloc(9); + snprintf( c, 6, "48;5;" ); + snprintf( c + 5, 4, "%i", num + 16 ); + + return c; +} -- cgit v1.2.3