aboutsummaryrefslogtreecommitdiff
path: root/src/color.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/color.c')
-rw-r--r--src/color.c9
1 files changed, 9 insertions, 0 deletions
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;
+}