diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2020-07-24 21:05:02 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2020-07-24 21:05:02 +0300 |
commit | e32fd4e7796d6e7c5a4803e45bc230378ec4dd0b (patch) | |
tree | 5232331654a977cf4ad1bf06eedc2f8752db6c32 /src/ui/color.c | |
parent | 0f0b4250ca460d58edb61cc0dd509ba1980c3272 (diff) |
Font update; ANSI color escapes; fixed URL update
Newer version of the Fira fonts, and added a separate UI font (Source Sans Pro).
The text renderer checks for the 4-bit ANSI color escapes for the setting the foreground color.
InputWidget supports paste from clipboard.
The navbar updates the current URL when the page has been loaded.
Diffstat (limited to 'src/ui/color.c')
-rw-r--r-- | src/ui/color.c | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/src/ui/color.c b/src/ui/color.c index d6a995c7..179006c1 100644 --- a/src/ui/color.c +++ b/src/ui/color.c | |||
@@ -1,5 +1,7 @@ | |||
1 | #include "color.h" | 1 | #include "color.h" |
2 | 2 | ||
3 | #include <the_Foundation/string.h> | ||
4 | |||
3 | static const iColor transparent_; | 5 | static const iColor transparent_; |
4 | 6 | ||
5 | iColor get_Color(int color) { | 7 | iColor get_Color(int color) { |
@@ -26,3 +28,65 @@ iColor get_Color(int color) { | |||
26 | } | 28 | } |
27 | return *clr; | 29 | return *clr; |
28 | } | 30 | } |
31 | |||
32 | iColor ansi_Color(iRangecc escapeSequence, int fallback) { | ||
33 | iColor clr = get_Color(fallback); | ||
34 | for (const char *ch = escapeSequence.start; ch < escapeSequence.end; ch++) { | ||
35 | char *endPtr; | ||
36 | unsigned long arg = strtoul(ch, &endPtr, 10); | ||
37 | ch = endPtr; | ||
38 | switch (arg) { | ||
39 | default: | ||
40 | break; | ||
41 | case 30: | ||
42 | clr = (iColor){ 0, 0, 0, 255 }; | ||
43 | break; | ||
44 | case 31: | ||
45 | clr = (iColor){ 170, 0, 0, 255 }; | ||
46 | break; | ||
47 | case 32: | ||
48 | clr = (iColor){ 0, 170, 0, 255 }; | ||
49 | break; | ||
50 | case 33: | ||
51 | clr = (iColor){ 170, 85, 0, 255 }; | ||
52 | break; | ||
53 | case 34: | ||
54 | clr = (iColor){ 0, 0, 170, 255 }; | ||
55 | break; | ||
56 | case 35: | ||
57 | clr = (iColor){ 170, 0, 170, 255 }; | ||
58 | break; | ||
59 | case 36: | ||
60 | clr = (iColor){ 0, 170, 170, 255 }; | ||
61 | break; | ||
62 | case 37: | ||
63 | clr = (iColor){ 170, 170, 170, 255 }; | ||
64 | break; | ||
65 | case 90: | ||
66 | clr = (iColor){ 85, 85, 85, 255 }; | ||
67 | break; | ||
68 | case 91: | ||
69 | clr = (iColor){ 255, 85, 85, 255 }; | ||
70 | break; | ||
71 | case 92: | ||
72 | clr = (iColor){ 85, 255, 85, 255 }; | ||
73 | break; | ||
74 | case 93: | ||
75 | clr = (iColor){ 255, 255, 85, 255 }; | ||
76 | break; | ||
77 | case 94: | ||
78 | clr = (iColor){ 85, 85, 255, 255 }; | ||
79 | break; | ||
80 | case 95: | ||
81 | clr = (iColor){ 255, 85, 255, 255 }; | ||
82 | break; | ||
83 | case 96: | ||
84 | clr = (iColor){ 85, 255, 255, 255 }; | ||
85 | break; | ||
86 | case 97: | ||
87 | clr = (iColor){ 255, 255, 255, 255 }; | ||
88 | break; | ||
89 | } | ||
90 | } | ||
91 | return clr; | ||
92 | } | ||