* 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
+15 -4
View File
@@ -9,6 +9,17 @@ bool SH1106Display::i2c_probe(TwoWire &wire, uint8_t addr)
return (error == 0);
}
// Color scheme
ColorVal UIColor::window_bkg = SH110X_BLACK;
ColorVal UIColor::title_bkg = SH110X_WHITE;
ColorVal UIColor::title_txt = SH110X_BLACK;
ColorVal UIColor::primary_txt = SH110X_WHITE;
ColorVal UIColor::secondary_txt = SH110X_WHITE;
ColorVal UIColor::warning_txt = SH110X_WHITE;
ColorVal UIColor::popup_bkg = SH110X_WHITE;
ColorVal UIColor::popup_txt = SH110X_BLACK;
ColorVal UIColor::corp_blue = SH110X_WHITE;
bool SH1106Display::begin()
{
// Wire must already be initialised by board.begin() before this is called.
@@ -35,7 +46,7 @@ void SH1106Display::clear()
display.display();
}
void SH1106Display::startFrame(Color bkg)
void SH1106Display::startFrame(ColorVal bkg)
{
display.clearDisplay(); // TODO: apply 'bkg'
_color = SH110X_WHITE;
@@ -49,9 +60,9 @@ void SH1106Display::setTextSize(int sz)
display.setTextSize(sz);
}
void SH1106Display::setColor(Color c)
void SH1106Display::setColor(ColorVal c)
{
_color = (c != 0) ? SH110X_WHITE : SH110X_BLACK;
_color = c;
display.setTextColor(_color);
}
@@ -77,7 +88,7 @@ void SH1106Display::drawRect(int x, int y, int w, int h)
void SH1106Display::drawXbm(int x, int y, const uint8_t *bits, int w, int h)
{
display.drawBitmap(x, y, bits, w, h, SH110X_WHITE);
display.drawBitmap(x, y, bits, w, h, _color);
}
uint16_t SH1106Display::getTextWidth(const char *str)