blob: 8d0a955885ee8f40d1ec2899a8f8929db0a798cf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
#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
*/
}
|