summaryrefslogtreecommitdiff
path: root/src/ui/color.h
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2020-08-16 16:15:30 +0300
committerJaakko Keränen <jaakko.keranen@iki.fi>2020-08-16 16:15:30 +0300
commit027d8185b10632092508bfda62467d24c9f8655b (patch)
tree03b0bf1edb9f2f284afde1679e24ac390b2f201d /src/ui/color.h
parentb10087331ff28acbc368361ba14dba3a70b7dc90 (diff)
Palette has UI colors; defined Light theme colors
Diffstat (limited to 'src/ui/color.h')
-rw-r--r--src/ui/color.h89
1 files changed, 72 insertions, 17 deletions
diff --git a/src/ui/color.h b/src/ui/color.h
index 6444ad03..77cbac09 100644
--- a/src/ui/color.h
+++ b/src/ui/color.h
@@ -3,8 +3,15 @@
3#include <the_Foundation/range.h> 3#include <the_Foundation/range.h>
4#include <the_Foundation/math.h> 4#include <the_Foundation/math.h>
5 5
6enum iColorTheme {
7 dark_ColorTheme,
8 light_ColorTheme,
9 max_ColorTheme
10};
11
6enum iColorId { 12enum iColorId {
7 none_ColorId = -1, 13 none_ColorId = -1,
14
8 black_ColorId, 15 black_ColorId,
9 gray25_ColorId, 16 gray25_ColorId,
10 gray50_ColorId, 17 gray50_ColorId,
@@ -20,6 +27,46 @@ enum iColorId {
20 blue_ColorId, 27 blue_ColorId,
21 green_ColorId, 28 green_ColorId,
22 29
30 /* user interface colors for semantic use */
31 uiFirst_ColorId,
32 uiBackground_ColorId = uiFirst_ColorId,
33 uiBackgroundHover_ColorId,
34 uiBackgroundPressed_ColorId,
35 uiBackgroundSelected_ColorId,
36 uiBackgroundFramelessHover_ColorId,
37 uiText_ColorId,
38 uiTextPressed_ColorId,
39 uiTextSelected_ColorId,
40 uiTextFramelessHover_ColorId,
41 uiTextFramelessSelected_ColorId,
42 uiTextStrong_ColorId,
43 uiTextShortcut_ColorId,
44 uiTextAction_ColorId,
45 uiTextCaution_ColorId,
46 uiFrame_ColorId,
47 uiEmboss1_ColorId,
48 uiEmboss2_ColorId,
49 uiEmbossHover1_ColorId,
50 uiEmbossHover2_ColorId,
51 uiEmbossPressed1_ColorId,
52 uiEmbossPressed2_ColorId,
53 uiEmbossSelected1_ColorId,
54 uiEmbossSelected2_ColorId,
55 uiEmbossSelectedHover1_ColorId,
56 uiEmbossSelectedHover2_ColorId,
57 uiInputBackground_ColorId,
58 uiInputBackgroundFocused_ColorId,
59 uiInputText_ColorId,
60 uiInputTextFocused_ColorId,
61 uiInputFrame_ColorId,
62 uiInputFrameHover_ColorId,
63 uiInputFrameFocused_ColorId,
64 uiInputCursor_ColorId,
65 uiInputCursorText_ColorId,
66 uiHeading_ColorId,
67 uiIcon_ColorId,
68 uiSeparator_ColorId,
69
23 /* content theme colors */ 70 /* content theme colors */
24 tmFirst_ColorId, 71 tmFirst_ColorId,
25 tmBackground_ColorId = tmFirst_ColorId, 72 tmBackground_ColorId = tmFirst_ColorId,
@@ -77,23 +124,27 @@ iLocalDef iBool isRegularText_ColorId(enum iColorId d) {
77 return isLinkText_ColorId(d) || d == tmParagraph_ColorId || d == tmFirstParagraph_ColorId; 124 return isLinkText_ColorId(d) || d == tmParagraph_ColorId || d == tmFirstParagraph_ColorId;
78} 125}
79 126
80#define mask_ColorId 0x3f 127#define mask_ColorId 0x7f
81#define permanent_ColorId 0x80 /* cannot be changed via escapes */ 128#define permanent_ColorId 0x80 /* cannot be changed via escapes */
82 129
83#define black_ColorEscape "\r0" 130#define black_ColorEscape "\r0"
84#define gray25_ColorEscape "\r1" 131#define gray25_ColorEscape "\r1"
85#define gray50_ColorEscape "\r2" 132#define gray50_ColorEscape "\r2"
86#define gray75_ColorEscape "\r3" 133#define gray75_ColorEscape "\r3"
87#define white_ColorEscape "\r4" 134#define white_ColorEscape "\r4"
88#define brown_ColorEscape "\r5" 135#define brown_ColorEscape "\r5"
89#define orange_ColorEscape "\r6" 136#define orange_ColorEscape "\r6"
90#define teal_ColorEscape "\r7" 137#define teal_ColorEscape "\r7"
91#define cyan_ColorEscape "\r8" 138#define cyan_ColorEscape "\r8"
92#define yellow_ColorEscape "\r9" 139#define yellow_ColorEscape "\r9"
93#define red_ColorEscape "\r:" 140#define red_ColorEscape "\r:"
94#define magenta_ColorEscape "\r;" 141#define magenta_ColorEscape "\r;"
95#define blue_ColorEscape "\r<" 142#define blue_ColorEscape "\r<"
96#define green_ColorEscape "\r=" 143#define green_ColorEscape "\r="
144#define uiText_ColorEscape "\rC"
145#define uiTextAction_ColorEscape "\rJ"
146#define uiTextCaution_ColorEscape "\rK"
147#define uiHeading_ColorEscape "\r`"
97 148
98iDeclareType(Color) 149iDeclareType(Color)
99iDeclareType(HSLColor) 150iDeclareType(HSLColor)
@@ -114,11 +165,15 @@ iHSLColor setLum_HSLColor (iHSLColor, float lum);
114iHSLColor addSatLum_HSLColor (iHSLColor, float sat, float lum); 165iHSLColor addSatLum_HSLColor (iHSLColor, float sat, float lum);
115 166
116iColor get_Color (int color); 167iColor get_Color (int color);
168int darker_Color (int color);
169int lighter_Color (int color);
117void set_Color (int color, iColor rgba); 170void set_Color (int color, iColor rgba);
118 171
119iLocalDef void setHsl_Color(int color, iHSLColor hsl) { 172iLocalDef void setHsl_Color(int color, iHSLColor hsl) {
120 set_Color(color, rgb_HSLColor(hsl)); 173 set_Color(color, rgb_HSLColor(hsl));
121} 174}
122 175
176void setThemePalette_Color (enum iColorTheme theme);
177
123iColor ansi_Color (iRangecc escapeSequence, int fallback); 178iColor ansi_Color (iRangecc escapeSequence, int fallback);
124const char * escape_Color (int color); 179const char * escape_Color (int color);