From dd9251bfa76b83e66e9c23c004a40c50cc173185 Mon Sep 17 00:00:00 2001 From: Peter Marquardt Date: Wed, 13 Jan 2016 15:40:31 +0100 Subject: [PATCH] added function to combine colors --- src/squared.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/squared.c b/src/squared.c index a582a3c..e27d4c5 100644 --- a/src/squared.c +++ b/src/squared.c @@ -214,6 +214,9 @@ static uint8_t shadowtable[] = {192,192,192,192,192,192,192,192,192,192,192,192, // alpha should only be 0b??111111 where ?? = 00 (full shade), 01 (much shade), 10 (some shade), 11 (none shade) static uint8_t alpha = 0b10111111; +uint8_t combine_colors(uint8_t bg_color, uint8_t fg_color) { + return (shadowtable[((~fg_color)&0b11000000) + (bg_color&63)]&63) + shadowtable[fg_color]; +} #define FONT_HEIGHT_BLOCKS (sizeof *FONT / sizeof **FONT) #define FONT_WIDTH_BLOCKS (sizeof **FONT)