From 4a395cae20c9cd0dcb8437390cf5e470e3c1720b Mon Sep 17 00:00:00 2001 From: Jonas Gunz Date: Sat, 29 Aug 2020 14:47:57 +0200 Subject: remove unneded --- src/color.c | 45 --------------------------------------------- 1 file changed, 45 deletions(-) (limited to 'src/color.c') diff --git a/src/color.c b/src/color.c index d7b3cdf..10afeea 100644 --- a/src/color.c +++ b/src/color.c @@ -28,42 +28,6 @@ uint8_t rgb_luminance(uint8_t R, uint8_t G, uint8_t B) return ret; } -char* calc_col(uint8_t R, uint8_t G, uint8_t B) -{ - unsigned int nearest_num = 0; - uint8_t a2[3]; - a2[0] = colors[0].R; - a2[1] = colors[0].G; - a2[2] = colors[0].B; - - uint8_t a1[] = {R,G,B}; - - //Normalize the color - //Does not really work all that well - /*while(a1[0] < 255 && a1[1] < 255 && a1[2] < 255) - { - a1[0]++; - a1[1]++; - a1[2]++; - }*/ - - float nearest_val = distance( a1, a2 ); - - for( unsigned int i = 1; i < _COLORS_SIZE; i++) - { - a2[0] = colors[i].R; - a2[1] = colors[i].G; - a2[2] = colors[i].B; - - float dist = distance(a1, a2); - if(dist < nearest_val){ - nearest_num = i; - nearest_val = dist; - } - } - return colors[ nearest_num ].no; -} -//TODO consolidate char* calc_col_ansi(uint8_t R, uint8_t G, uint8_t B, uint8_t _mode) { int mode = _mode == COLOR_BG ? 4 : 3; @@ -74,12 +38,3 @@ char* calc_col_ansi(uint8_t R, uint8_t G, uint8_t B, uint8_t _mode) 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