mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-11-02 10:51:57 +00:00
refactor(ui): upstream's UIColor palette in place of the DARK/LIGHT enum
- DisplayDriver takes ColorVal; each driver's .cpp defines the UIColor roles (window_bkg, primary_txt, ...) in its own values. ui-new draws in two: window_bkg and primary_txt. OLED and e-ink look as before (sim screens pixel-identical). - E213, E290, LGFX, Null, ST7735, ST7789LCD, U8g2 taken whole from upstream (with them the rewritten ST7735 driver and the Heltec V4 R8 TFT display). - SH1106, SSD1306, ST7789, EinkGfxDisplay and the sim drivers converted. - ui-orig, ui-tiny, simple_* get upstream's colour roles; the repeater's UI taken from upstream (its power-off screen). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -29,7 +29,7 @@ inline void draw(DisplayDriver& d, int x, int y, int w, const struct tm& t, uint
|
||||
static const char* const INITIALS[] = { "M", "T", "W", "T", "F", "S", "S" };
|
||||
const int lh = d.getLineHeight(), step = tight ? lh : lh + 2, cw = w / 7;
|
||||
const int x0 = x + (w - 7 * cw) / 2;
|
||||
d.setColor(DisplayDriver::LIGHT);
|
||||
d.setColor(UIColor::primary_txt);
|
||||
for (int c = 0; c < 7; c++) d.drawTextCentered(x0 + c * cw + cw / 2, y, (tight ? INITIALS : NAMES)[c]);
|
||||
info::rule(d, x0, y + (tight ? lh - 1 : lh + 1), 7 * cw);
|
||||
const int top = y + (tight ? lh + 1 : step + 3), col0 = firstCol(t), n = daysIn(t.tm_year, t.tm_mon);
|
||||
@@ -40,17 +40,17 @@ inline void draw(DisplayDriver& d, int x, int y, int w, const struct tm& t, uint
|
||||
if (today && day == t.tm_mday) {
|
||||
if (tight) d.fillSoftRect(cx, cy - 1, cw, lh);
|
||||
else d.fillSoftRect(cx + 1, cy - 1, cw - 2, lh + 2);
|
||||
d.setColor(DisplayDriver::DARK);
|
||||
d.setColor(UIColor::window_bkg);
|
||||
d.drawTextCentered(cx + cw / 2, cy, buf);
|
||||
d.setColor(DisplayDriver::LIGHT);
|
||||
d.setColor(UIColor::primary_txt);
|
||||
} else {
|
||||
d.drawTextCentered(cx + cw / 2, cy, buf);
|
||||
}
|
||||
if (marked & (1UL << (day - 1))) { // under the number, in the gap below it
|
||||
const int uw = d.getTextWidth(buf);
|
||||
d.setColor(today && day == t.tm_mday ? DisplayDriver::DARK : DisplayDriver::LIGHT);
|
||||
d.setColor(today && day == t.tm_mday ? UIColor::window_bkg : UIColor::primary_txt);
|
||||
d.fillRect(cx + (cw - uw) / 2, cy + (tight ? lh - 2 : lh), uw, d.sepH());
|
||||
d.setColor(DisplayDriver::LIGHT);
|
||||
d.setColor(UIColor::primary_txt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user