diff options
Diffstat (limited to 'src/ui/labelwidget.c')
-rw-r--r-- | src/ui/labelwidget.c | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/src/ui/labelwidget.c b/src/ui/labelwidget.c index 1805525c..d16ef69d 100644 --- a/src/ui/labelwidget.c +++ b/src/ui/labelwidget.c | |||
@@ -172,6 +172,10 @@ static void getColors_LabelWidget_(const iLabelWidget *d, int *bg, int *fg, int | |||
172 | *frame2 = uiEmbossSelected2_ColorId; | 172 | *frame2 = uiEmbossSelected2_ColorId; |
173 | } | 173 | } |
174 | } | 174 | } |
175 | int colorEscape = none_ColorId; | ||
176 | if (startsWith_String(&d->label, "\r")) { | ||
177 | colorEscape = cstr_String(&d->label)[1] - asciiBase_ColorEscape; /* TODO: can be two bytes long */ | ||
178 | } | ||
175 | if (isHover_Widget(w)) { | 179 | if (isHover_Widget(w)) { |
176 | if (isFrameless) { | 180 | if (isFrameless) { |
177 | *bg = uiBackgroundFramelessHover_ColorId; | 181 | *bg = uiBackgroundFramelessHover_ColorId; |
@@ -179,14 +183,14 @@ static void getColors_LabelWidget_(const iLabelWidget *d, int *bg, int *fg, int | |||
179 | } | 183 | } |
180 | else { | 184 | else { |
181 | /* Frames matching color escaped text. */ | 185 | /* Frames matching color escaped text. */ |
182 | if (startsWith_String(&d->label, "\r")) { | 186 | if (colorEscape != none_ColorId) { |
183 | if (isDark_ColorTheme(colorTheme_App())) { | 187 | if (isDark_ColorTheme(colorTheme_App())) { |
184 | *frame1 = cstr_String(&d->label)[1] - asciiBase_ColorEscape; | 188 | *frame1 = colorEscape; |
185 | *frame2 = darker_Color(*frame1); | 189 | *frame2 = darker_Color(*frame1); |
186 | } | 190 | } |
187 | else { | 191 | else { |
188 | *bg = *frame1 = *frame2 = cstr_String(&d->label)[1] - asciiBase_ColorEscape; | 192 | *bg = *frame1 = *frame2 = colorEscape; |
189 | *fg = uiBackground_ColorId | permanent_ColorId; | 193 | *fg = uiText_ColorId | permanent_ColorId; |
190 | } | 194 | } |
191 | } | 195 | } |
192 | else if (isSel) { | 196 | else if (isSel) { |
@@ -204,9 +208,14 @@ static void getColors_LabelWidget_(const iLabelWidget *d, int *bg, int *fg, int | |||
204 | *bg = uiBackgroundPressed_ColorId | permanent_ColorId; | 208 | *bg = uiBackgroundPressed_ColorId | permanent_ColorId; |
205 | if (isButton) { | 209 | if (isButton) { |
206 | *frame1 = uiEmbossPressed1_ColorId; | 210 | *frame1 = uiEmbossPressed1_ColorId; |
207 | *frame2 = uiEmbossPressed2_ColorId; | 211 | *frame2 = colorEscape != none_ColorId ? colorEscape : uiEmbossPressed2_ColorId; |
212 | } | ||
213 | if (colorEscape == none_ColorId || colorEscape == uiTextAction_ColorId) { | ||
214 | *fg = uiTextPressed_ColorId | permanent_ColorId; | ||
215 | } | ||
216 | else { | ||
217 | *fg = isDark_ColorTheme(colorTheme_App()) ? white_ColorId : black_ColorId; | ||
208 | } | 218 | } |
209 | *fg = uiTextPressed_ColorId | permanent_ColorId; | ||
210 | } | 219 | } |
211 | if (d->forceFg >= 0) { | 220 | if (d->forceFg >= 0) { |
212 | *fg = d->forceFg; | 221 | *fg = d->forceFg; |
@@ -288,7 +297,9 @@ static void draw_LabelWidget_(const iLabelWidget *d) { | |||
288 | add_I2(topRight_Rect(bounds), | 297 | add_I2(topRight_Rect(bounds), |
289 | addX_I2(negX_I2(padding_(flags)), | 298 | addX_I2(negX_I2(padding_(flags)), |
290 | deviceType_App() == tablet_AppDeviceType ? gap_UI : 0)), | 299 | deviceType_App() == tablet_AppDeviceType ? gap_UI : 0)), |
291 | flags & pressed_WidgetFlag ? fg : uiTextShortcut_ColorId, | 300 | flags & pressed_WidgetFlag ? fg |
301 | : isCaution ? uiTextCaution_ColorId | ||
302 | : uiTextShortcut_ColorId, | ||
292 | right_Alignment, | 303 | right_Alignment, |
293 | cstr_String(&str)); | 304 | cstr_String(&str)); |
294 | deinit_String(&str); | 305 | deinit_String(&str); |