summaryrefslogtreecommitdiff
path: root/src/ui/color.c
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2020-07-29 07:42:30 +0300
committerJaakko Keränen <jaakko.keranen@iki.fi>2020-07-29 07:42:30 +0300
commit4deb72ba6ea6c055dff69d74669887f30ea01e54 (patch)
treeea9b9645b38367afabaa66637c15d9a1cd0c3374 /src/ui/color.c
parentd921021132367076cd2a5f120b3a49db6e29acf7 (diff)
Showing and hiding image content
Diffstat (limited to 'src/ui/color.c')
-rw-r--r--src/ui/color.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/ui/color.c b/src/ui/color.c
index 330dab1d..46d8a71f 100644
--- a/src/ui/color.c
+++ b/src/ui/color.c
@@ -30,6 +30,31 @@ iColor get_Color(int color) {
30 return *clr; 30 return *clr;
31} 31}
32 32
33const char *escape_Color(int color) {
34 static const char *esc[] = {
35 black_ColorEscape,
36 gray15_ColorEscape,
37 gray25_ColorEscape,
38 gray50_ColorEscape,
39 gray75_ColorEscape,
40 gray88_ColorEscape,
41 white_ColorEscape,
42 brown_ColorEscape,
43 orange_ColorEscape,
44 teal_ColorEscape,
45 cyan_ColorEscape,
46 yellow_ColorEscape,
47 red_ColorEscape,
48 magenta_ColorEscape,
49 blue_ColorEscape,
50 green_ColorEscape,
51 };
52 if (color >= 0 && color < max_ColorId) {
53 return esc[color];
54 }
55 return white_ColorEscape;
56}
57
33iColor ansi_Color(iRangecc escapeSequence, int fallback) { 58iColor ansi_Color(iRangecc escapeSequence, int fallback) {
34 iColor clr = get_Color(fallback); 59 iColor clr = get_Color(fallback);
35 for (const char *ch = escapeSequence.start; ch < escapeSequence.end; ch++) { 60 for (const char *ch = escapeSequence.start; ch < escapeSequence.end; ch++) {