aboutsummaryrefslogtreecommitdiff
path: root/src/colors.c
diff options
context:
space:
mode:
authordavid <[email protected]>2026-10-11 03:14:19 -0300
committerdavid <[email protected]>2026-10-11 03:14:19 -0300
commitd77d131661132816f49013a7d38f7216374b821d (patch)
tree3ff3e7debfb9a3dab6aafd8c0a378ed6621b4b83 /src/colors.c
parent0b9d62202ab3f7a1eb349b0e7c1667de0c022cfe (diff)
downloadmikusays-c-d77d131661132816f49013a7d38f7216374b821d.tar.gz
mikusays-c-d77d131661132816f49013a7d38f7216374b821d.zip
started colors, i have a things noted on the side that's not in the repo but i have most of the functions planned
Diffstat (limited to 'src/colors.c')
-rw-r--r--src/colors.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/colors.c b/src/colors.c
index 3e49870..4de484a 100644
--- a/src/colors.c
+++ b/src/colors.c
@@ -1,3 +1,41 @@
#include "../defs/all.h"
+#include <stdlib.h>
+#include <string.h>
+#include <strings.h>
+void colorconfig_init(colorconfig config){
+ config.saturation = 100;
+ config.brightness = 50;
+}
+
+enum color_mode detect_color_mode(void){
+ const char *colorterm, *term;
+
+ if(getenv("NO_COLOR"))
+ return MODE_NONE;
+
+ colorterm = getenv("COLORTERM");
+ if(colorterm && (strstr(colorterm, "truecolor") || strstr(colorterm, "24bit")))
+ return MODE_TRUECOLOR;
+
+ term = getenv("TERM");
+ if(term && strstr(term, "256color"))
+ return MODE_ANSI256;
+
+ return MODE_ANSI16;
+}
+
+#ifdef _WIN32
+//i'll do this later
+#endif
+
+char parse_namedcolors(rgbcolor name, char *outrgb){
+ /*
+ table = array of { name_string, rgb } for the 16 colors
+ normalized = lowercase copy of name, with "_" removed // so that it handles bright_red and brightred
+ for each entry in the table:
+ if normalized equals entry.name -> out_rgb = entry.rgb, return success
+ return fail
+ */
+}