aboutsummaryrefslogtreecommitdiff
path: root/src/color.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/color.h')
-rw-r--r--src/color.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/color.h b/src/color.h
new file mode 100644
index 0000000..10d376e
--- /dev/null
+++ b/src/color.h
@@ -0,0 +1,33 @@
+#ifndef _COLOR_H_
+#define _COLOR_H_
+
+#include <stdint.h>
+#include <math.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#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);
+
+char *calc_col_ansi(uint8_t R, uint8_t G, uint8_t B);
+
+#endif //_COLOR_H_