* refactor of Color mapping in UITasks / DisplayDrivers

* color displays now with a new light theme
This commit is contained in:
Scott Powell
2026-07-22 16:03:33 +10:00
parent 78240e9477
commit b8504e55c6
32 changed files with 313 additions and 285 deletions
+18 -11
View File
@@ -14,6 +14,18 @@
SPIClass SPI1 = SPIClass(FSPI);
#endif
// Color scheme
ColorVal UIColor::window_bkg = GxEPD_WHITE;
ColorVal UIColor::title_bkg = GxEPD_BLACK;
ColorVal UIColor::title_txt = GxEPD_WHITE;
ColorVal UIColor::primary_txt = GxEPD_BLACK;
ColorVal UIColor::secondary_txt = GxEPD_BLACK;
ColorVal UIColor::warning_txt = GxEPD_BLACK;
ColorVal UIColor::popup_bkg = GxEPD_BLACK;
ColorVal UIColor::popup_txt = GxEPD_WHITE;
ColorVal UIColor::corp_blue = GxEPD_BLACK;
bool GxEPDDisplay::begin() {
display.epd2.selectSPI(SPI1, SPISettings(4000000, MSBFIRST, SPI_MODE0));
#ifdef ESP32
@@ -61,9 +73,9 @@ void GxEPDDisplay::clear() {
display_crc.reset();
}
void GxEPDDisplay::startFrame(Color bkg) {
display.fillScreen(GxEPD_WHITE);
display.setTextColor(_curr_color = GxEPD_BLACK);
void GxEPDDisplay::startFrame(ColorVal bkg) {
display.fillScreen(bkg);
display.setTextColor(_curr_color = UIColor::primary_txt);
display_crc.reset();
}
@@ -85,14 +97,9 @@ void GxEPDDisplay::setTextSize(int sz) {
}
}
void GxEPDDisplay::setColor(Color c) {
display_crc.update<Color> (c);
// colours need to be inverted for epaper displays
if (c == DARK) {
display.setTextColor(_curr_color = GxEPD_WHITE);
} else {
display.setTextColor(_curr_color = GxEPD_BLACK);
}
void GxEPDDisplay::setColor(ColorVal c) {
display_crc.update<ColorVal> (c);
display.setTextColor(_curr_color = c);
}
void GxEPDDisplay::setCursor(int x, int y) {