mirror of
https://github.com/meshcore-dev/MeshCore.git
synced 2026-10-06 16:27:59 +00:00
* refactor of Color mapping in UITasks / DisplayDrivers
* color displays now with a new light theme
This commit is contained in:
@@ -2,6 +2,17 @@
|
||||
|
||||
#include "../../MeshCore.h"
|
||||
|
||||
// Color scheme
|
||||
ColorVal UIColor::window_bkg = WHITE;
|
||||
ColorVal UIColor::title_bkg = BLACK;
|
||||
ColorVal UIColor::title_txt = WHITE;
|
||||
ColorVal UIColor::primary_txt = BLACK;
|
||||
ColorVal UIColor::secondary_txt = BLACK;
|
||||
ColorVal UIColor::warning_txt = BLACK;
|
||||
ColorVal UIColor::popup_bkg = BLACK;
|
||||
ColorVal UIColor::popup_txt = WHITE;
|
||||
ColorVal UIColor::corp_blue = BLACK;
|
||||
|
||||
bool E290Display::begin() {
|
||||
if (_init) return true;
|
||||
|
||||
@@ -62,15 +73,17 @@ void E290Display::clear() {
|
||||
display.clear();
|
||||
}
|
||||
|
||||
void E290Display::startFrame(Color bkg) {
|
||||
void E290Display::startFrame(ColorVal bkg) {
|
||||
display_crc.reset();
|
||||
|
||||
// Fill screen with white first to ensure clean background
|
||||
display.fillRect(0, 0, width(), height(), WHITE);
|
||||
if (bkg == LIGHT) {
|
||||
if (bkg == 0) {
|
||||
// Fill with black if light background requested (inverted for e-ink)
|
||||
display.fillRect(0, 0, width(), height(), BLACK);
|
||||
}
|
||||
_color = UIColor::primary_txt;
|
||||
display.setTextColor(_color);
|
||||
}
|
||||
|
||||
void E290Display::setTextSize(int sz) {
|
||||
@@ -79,9 +92,10 @@ void E290Display::setTextSize(int sz) {
|
||||
display.setTextSize(sz);
|
||||
}
|
||||
|
||||
void E290Display::setColor(Color c) {
|
||||
display_crc.update<Color>(c);
|
||||
// implemented in individual display methods
|
||||
void E290Display::setColor(ColorVal c) {
|
||||
_color = c;
|
||||
display_crc.update<ColorVal>(c);
|
||||
display.setTextColor(_color);
|
||||
}
|
||||
|
||||
void E290Display::setCursor(int x, int y) {
|
||||
@@ -100,7 +114,7 @@ void E290Display::fillRect(int x, int y, int w, int h) {
|
||||
display_crc.update<int>(y);
|
||||
display_crc.update<int>(w);
|
||||
display_crc.update<int>(h);
|
||||
display.fillRect(x, y, w, h, BLACK);
|
||||
display.fillRect(x, y, w, h, _color);
|
||||
}
|
||||
|
||||
void E290Display::drawRect(int x, int y, int w, int h) {
|
||||
@@ -108,7 +122,7 @@ void E290Display::drawRect(int x, int y, int w, int h) {
|
||||
display_crc.update<int>(y);
|
||||
display_crc.update<int>(w);
|
||||
display_crc.update<int>(h);
|
||||
display.drawRect(x, y, w, h, BLACK);
|
||||
display.drawRect(x, y, w, h, _color);
|
||||
}
|
||||
|
||||
void E290Display::drawXbm(int x, int y, const uint8_t *bits, int w, int h) {
|
||||
@@ -132,7 +146,7 @@ void E290Display::drawXbm(int x, int y, const uint8_t *bits, int w, int h) {
|
||||
|
||||
// If the bit is set, draw the pixel
|
||||
if (bitSet) {
|
||||
display.drawPixel(x + bx, y + by, BLACK);
|
||||
display.drawPixel(x + bx, y + by, _color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user