Skip to content

Commit efd8757

Browse files
committed
🚸 "Inverted" text on GLCD
1 parent 21dadce commit efd8757

File tree

4 files changed

+13
-4
lines changed

4 files changed

+13
-4
lines changed

Marlin/src/lcd/tft/themes/theme_ANET_BLACK.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
#define COLOR_SD_DISABLED COLOR_CONTROL_DISABLED
4848
#define COLOR_MENU_TEXT COLOR_WHITE
4949
#define COLOR_MENU_STATIC_TEXT COLOR_WHITE
50+
#define COLOR_MENU_INVERT_TEXT COLOR_YELLOW
5051
#define COLOR_MENU_BACK_TEXT COLOR_YELLOW
5152
#define COLOR_MENU_EDIT_TEXT COLOR_LIME2
5253
#define COLOR_MENU_VALUE_FONT COLOR_ORANGE2

Marlin/src/lcd/tft/themes/theme_BLUE_MARLIN.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,12 @@
106106
#ifndef COLOR_MENU_TEXT
107107
#define COLOR_MENU_TEXT COLOR_YELLOW
108108
#endif
109-
#ifndef COLOR_MENU_TEXT
109+
#ifndef COLOR_MENU_STATIC_TEXT
110110
#define COLOR_MENU_STATIC_TEXT COLOR_SILVER
111111
#endif
112+
#ifndef COLOR_MENU_INVERT_TEXT
113+
#define COLOR_MENU_INVERT_TEXT COLOR_WHITE
114+
#endif
112115
#ifndef COLOR_MENU_BACK_TEXT
113116
#define COLOR_MENU_BACK_TEXT COLOR_CYAN
114117
#endif

Marlin/src/lcd/tft/themes/theme_default.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,9 @@
107107
#ifndef COLOR_MENU_STATIC_TEXT
108108
#define COLOR_MENU_STATIC_TEXT COLOR_SILVER
109109
#endif
110+
#ifndef COLOR_MENU_INVERT_TEXT
111+
#define COLOR_MENU_INVERT_TEXT COLOR_WHITE
112+
#endif
110113
#ifndef COLOR_MENU_BACK_TEXT
111114
#define COLOR_MENU_BACK_TEXT COLOR_WHITE
112115
#endif

Marlin/src/lcd/tft/ui_common.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -390,23 +390,25 @@ void MenuItem_static::draw(const uint8_t row, FSTR_P const ftpl, const uint8_t s
390390
else
391391
tft_string.set();
392392

393+
const uint16_t color = (style & SS_INVERT) ? COLOR_MENU_INVERT_TEXT : COLOR_MENU_STATIC_TEXT;
394+
393395
const bool center = bool(style & SS_CENTER), full = bool(style & SS_FULL);
394396
if (!full || !vstr) {
395397
if (vstr) tft_string.add(vstr);
396-
tft.add_text(center ? tft_string.center(TFT_WIDTH) : 0, MENU_TEXT_Y, COLOR_MENU_STATIC_TEXT, tft_string);
398+
tft.add_text(center ? tft_string.center(TFT_WIDTH) : 0, MENU_TEXT_Y, color, tft_string);
397399
return;
398400
}
399401

400402
// Move the leading colon from the value to the label
401403
if (*vstr == ':') { tft_string.add(':'); vstr++; }
402404

403405
// Left-justified label
404-
tft.add_text(0, MENU_TEXT_Y, COLOR_MENU_STATIC_TEXT, tft_string);
406+
tft.add_text(0, MENU_TEXT_Y, color, tft_string);
405407

406408
// Right-justified value, after spaces
407409
while (*vstr == ' ') vstr++;
408410
tft_string.set(vstr);
409-
tft.add_text(TFT_WIDTH - 1 - tft_string.width(), MENU_TEXT_Y, COLOR_MENU_STATIC_TEXT, tft_string);
411+
tft.add_text(TFT_WIDTH - 1 - tft_string.width(), MENU_TEXT_Y, color, tft_string);
410412
}
411413

412414
#if HAS_MEDIA

0 commit comments

Comments
 (0)