diff options
author | Jonas Gunz <himself@jonasgunz.de> | 2019-05-03 03:07:07 +0200 |
---|---|---|
committer | Jonas Gunz <himself@jonasgunz.de> | 2019-05-03 03:07:07 +0200 |
commit | 620a534e46a78e2664f1a105c694330fc267453b (patch) | |
tree | 0bff0c9b6e0bd7ed11855450cad03a0ed2ba31f1 /color.h | |
parent | 4aa0cf5afc35509ccbfc23c722672c5a7a89001c (diff) | |
download | AsciiMap-620a534e46a78e2664f1a105c694330fc267453b.tar.gz |
Did a fuck ton.
Diffstat (limited to 'color.h')
-rw-r--r-- | color.h | 33 |
1 files changed, 33 insertions, 0 deletions
@@ -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); + +void generate_ansi(); + +#endif //_COLOR_H_ |