aboutsummaryrefslogtreecommitdiff
path: root/src/character.c
diff options
context:
space:
mode:
authorGravatar Jonas Gunz <himself@jonasgunz.de> 2020-08-30 12:52:18 +0200
committerGravatar Jonas Gunz <himself@jonasgunz.de> 2020-08-30 12:52:18 +0200
commita69e0fa11aa64c6b27e903821a3b8d008f33cc06 (patch)
tree852554cdb93083c23fe51067638d45827d11f44d /src/character.c
parent4a395cae20c9cd0dcb8437390cf5e470e3c1720b (diff)
downloadAsciiMap-a69e0fa11aa64c6b27e903821a3b8d008f33cc06.tar.gz
removed unused functions, removed color.{c,h}
Diffstat (limited to 'src/character.c')
-rw-r--r--src/character.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/character.c b/src/character.c
index 8a42370..5aa2e92 100644
--- a/src/character.c
+++ b/src/character.c
@@ -10,3 +10,14 @@ char calc_char(uint8_t _c , uint8_t _min, uint8_t _max, char *_custom_map)
float c = (float)(_c) / (_max - _min);
return map [(int)( strlen( map ) * (c))];
}
+
+char* calc_col_ansi(uint8_t R, uint8_t G, uint8_t B, uint8_t _mode)
+{
+ int mode = _mode == COLOR_BG ? 4 : 3;
+ int num = 36 * (R/51) + 6 * (G/51) + (B/51);
+ char *c = malloc(12);
+ snprintf( c, 8, "\e[%i8;5;", mode );
+ snprintf( c + 7, 5, "%im", num + 16 );
+
+ return c;
+}