From 620a534e46a78e2664f1a105c694330fc267453b Mon Sep 17 00:00:00 2001 From: Jonas Gunz Date: Fri, 3 May 2019 03:07:07 +0200 Subject: Did a fuck ton. --- color.h | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 color.h (limited to 'color.h') diff --git a/color.h b/color.h new file mode 100644 index 0000000..f5e1f88 --- /dev/null +++ b/color.h @@ -0,0 +1,33 @@ +#ifndef _COLOR_H_ +#define _COLOR_H_ + +#include +#include +#include +#include + +#include "m.h" + +#define _COLORS_SIZE 16u + +struct console_color +{ + uint8_t R; + uint8_t G; + uint8_t B; + + char *no; +}; + +struct console_color colors[ _COLORS_SIZE ]; + +//Calculate luminance +//Order LSB first: BGR +uint8_t rgb_avg(uint8_t R, uint8_t G, uint8_t B); + +//Get nearest printable color in console +char *calc_col(uint8_t R, uint8_t G, uint8_t B); + +void generate_ansi(); + +#endif //_COLOR_H_ -- cgit v1.2.3