summaryrefslogtreecommitdiff
path: root/src/ui/color.h
blob: d8b1f4d16088ce48a90c1b3e12ccec827117d30a (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
44
45
46
47
48
49
50
51
52
53
#pragma once

#include <the_Foundation/range.h>

enum iColorId {
    none_ColorId = -1,
    black_ColorId,
    gray15_ColorId,
    gray25_ColorId,
    gray50_ColorId,
    gray75_ColorId,
    gray88_ColorId,
    white_ColorId,
    brown_ColorId,    
    orange_ColorId,
    teal_ColorId,
    cyan_ColorId,
    yellow_ColorId,
    red_ColorId,
    magenta_ColorId,
    blue_ColorId,
    green_ColorId,
    max_ColorId
};

#define mask_ColorId        0x0f
#define permanent_ColorId   0x80 /* cannot be changed via escapes */

#define black_ColorEscape   "\r0"
#define gray15_ColorEscape  "\r1"
#define gray25_ColorEscape  "\r2"
#define gray50_ColorEscape  "\r3"
#define gray75_ColorEscape  "\r4"
#define gray88_ColorEscape  "\r5"
#define white_ColorEscape   "\r6"
#define brown_ColorEscape   "\r7"
#define orange_ColorEscape  "\r8"
#define teal_ColorEscape    "\r9"
#define cyan_ColorEscape    "\r:"
#define yellow_ColorEscape  "\r;"
#define red_ColorEscape     "\r<"
#define magenta_ColorEscape "\r="
#define blue_ColorEscape    "\r>"
#define green_ColorEscape   "\r?"

iDeclareType(Color)

struct Impl_Color {
    uint8_t r, g, b, a;
};

iColor  get_Color   (int color);
iColor  ansi_Color  (iRangecc escapeSequence, int fallback);