OS theme colors as suggested by JimB40 in #506 #540

Did the scripted search and replace of theme colors to introduce 11 new colors replacing 40 old colors.
This commit is contained in:
jfrickmann
2021-08-05 21:00:13 -04:00
parent 4aade1d0da
commit 27c067553b
15 changed files with 74 additions and 74 deletions
+8 -8
View File
@@ -70,20 +70,20 @@ void Button::checkEvents()
void TextButton::paint(BitmapBuffer * dc)
{
auto textColor = DEFAULT_COLOR;
auto bgColor = FIELD_FRAME_COLOR;
auto textColor = COLOR_THEME_SECONDARY1;
auto bgColor = COLOR_THEME_SECONDARY2;
if (bgColorHandler) {
bgColor = bgColorHandler();
} else if (checked()) {
bgColor = HIGHLIGHT_COLOR;
bgColor = COLOR_THEME_ACTIVE;
} else if (hasFocus()) {
bgColor = FOCUS_BGCOLOR;
bgColor = COLOR_THEME_FOCUS;
}
if (checked()) {
if (hasFocus()) {
dc->drawSolidRect(0, 0, rect.w, rect.h, 2, FOCUS_BGCOLOR);
dc->drawSolidRect(0, 0, rect.w, rect.h, 2, COLOR_THEME_FOCUS);
dc->drawSolidFilledRect(3, 3, rect.w - 6, rect.h - 6, bgColor);
} else {
dc->drawSolidFilledRect(0, 0, rect.w, rect.h, bgColor);
@@ -93,13 +93,13 @@ void TextButton::paint(BitmapBuffer * dc)
dc->drawSolidFilledRect(0, 0, rect.w, rect.h, bgColor);
if (windowFlags & BUTTON_BACKGROUND) {
if (hasFocus()) {
textColor = FOCUS_COLOR;
textColor = COLOR_THEME_PRIMARY2;
}
} else if (hasFocus()) {
dc->drawSolidRect(0, 0, rect.w, rect.h, 2, FOCUS_BGCOLOR);
dc->drawSolidRect(0, 0, rect.w, rect.h, 2, COLOR_THEME_FOCUS);
}
else {
dc->drawSolidRect(0, 0, rect.w, rect.h, 1, FIELD_FRAME_COLOR);
dc->drawSolidRect(0, 0, rect.w, rect.h, 1, COLOR_THEME_SECONDARY2);
}
}
+1 -1
View File
@@ -41,7 +41,7 @@ class ColorBox: public Window {
void paint(BitmapBuffer * dc) override
{
dc->drawSolidFilledRect(0, 0, width(), height(), DEFAULT_COLOR);
dc->drawSolidFilledRect(0, 0, width(), height(), COLOR_THEME_SECONDARY1);
dc->drawSolidFilledRect(1, 1, width() - 2, height() - 2, color << 16);
}
+6 -6
View File
@@ -87,17 +87,17 @@ void FormField::setFocus(uint8_t flag, Window * from)
void FormField::paint(BitmapBuffer * dc)
{
if (editMode) {
dc->drawSolidFilledRect(0, 0, rect.w, rect.h, EDIT_MARKER_COLOR);
dc->drawSolidFilledRect(0, 0, rect.w, rect.h, COLOR_THEME_EDIT);
}
else {
if (!(windowFlags & FORM_NO_BORDER)) {
if (hasFocus()) {
dc->drawSolidFilledRect(0, 0, rect.w, rect.h, FOCUS_BGCOLOR);
dc->drawSolidFilledRect(0, 0, rect.w, rect.h, COLOR_THEME_FOCUS);
} else if (!(windowFlags & FORM_BORDER_FOCUS_ONLY)) {
dc->drawSolidFilledRect(0, 0, rect.w, rect.h, FIELD_BGCOLOR);
dc->drawSolidRect(0, 0, rect.w, rect.h, 1, FIELD_FRAME_COLOR);
dc->drawSolidFilledRect(0, 0, rect.w, rect.h, COLOR_THEME_PRIMARY2);
dc->drawSolidRect(0, 0, rect.w, rect.h, 1, COLOR_THEME_SECONDARY2);
}
}
}
@@ -271,10 +271,10 @@ void FormGroup::paint(BitmapBuffer * dc)
{
if (!(windowFlags & (FORM_NO_BORDER | FORM_FORWARD_FOCUS))) {
if (!editMode && hasFocus()) {
dc->drawSolidRect(0, 0, rect.w, rect.h, 2, FOCUS_BGCOLOR);
dc->drawSolidRect(0, 0, rect.w, rect.h, 2, COLOR_THEME_FOCUS);
}
else if (!(windowFlags & FORM_BORDER_FOCUS_ONLY)) {
dc->drawSolidRect(0, 0, rect.w, rect.h, 1, FIELD_FRAME_COLOR);
dc->drawSolidRect(0, 0, rect.w, rect.h, 1, COLOR_THEME_SECONDARY2);
}
}
}
+3 -3
View File
@@ -112,17 +112,17 @@ void TextKeyboard::paint(BitmapBuffer * dc)
}
else if (*c == KEYBOARD_SPACE[0]) {
// spacebar
dc->drawBitmapPattern(x, y, LBM_KEY_SPACEBAR, DEFAULT_COLOR);
dc->drawBitmapPattern(x, y, LBM_KEY_SPACEBAR, COLOR_THEME_SECONDARY1);
x += 135;
}
else if (*c == KEYBOARD_ENTER[0]) {
// enter
dc->drawSolidFilledRect(x, y-2, 80, 25, TEXT_DISABLE_COLOR);
dc->drawSolidFilledRect(x, y-2, 80, 25, COLOR_THEME_DISABLED);
dc->drawText(x+40, y, "ENTER", CENTERED);
x += 80;
}
else if (int8_t(*c) < 0) {
dc->drawBitmapPattern(x, y, LBM_SPECIAL_KEYS[uint8_t(*c - 128)], DEFAULT_COLOR);
dc->drawBitmapPattern(x, y, LBM_SPECIAL_KEYS[uint8_t(*c - 128)], COLOR_THEME_SECONDARY1);
x += 45;
}
else {
+17 -17
View File
@@ -36,21 +36,21 @@ event_t getWindowEvent();
// These colors MUST be defined
//
// #define DEFAULT_COLOR
// #define DEFAULT_BGCOLOR
// #define FOCUS_COLOR
// #define FOCUS_BGCOLOR
// #define DISABLE_COLOR
// #define HIGHLIGHT_COLOR
// #define CHECKBOX_COLOR
// #define SCROLLBAR_COLOR
// #define MENU_COLOR
// #define MENU_BGCOLOR
// #define MENU_TITLE_BGCOLOR
// #define MENU_LINE_COLOR
// #define MENU_HIGHLIGHT_COLOR
// #define MENU_HIGHLIGHT_BGCOLOR
// #define OVERLAY_COLOR
// #define TABLE_BGCOLOR
// #define TABLE_HEADER_BGCOLOR
// #define COLOR_THEME_SECONDARY1
// #define COLOR_THEME_SECONDARY3
// #define COLOR_THEME_PRIMARY2
// #define COLOR_THEME_FOCUS
// #define COLOR_THEME_DISABLED
// #define COLOR_THEME_ACTIVE
// #define COLOR_THEME_FOCUS
// #define COLOR_THEME_PRIMARY3
// #define COLOR_THEME_SECONDARY1
// #define COLOR_THEME_PRIMARY2
// #define COLOR_THEME_SECONDARY1_THEME_SECONDARY1
// #define COLOR_THEME_SECONDARY2
// #define COLOR_THEME_PRIMARY2
// #define COLOR_THEME_FOCUS
// #define COLOR_THEME_PRIMARY1
// #define COLOR_THEME_SECONDARY3
// #define COLOR_THEME_FOCUS
// #define CUSTOM_COLOR
+9 -9
View File
@@ -104,16 +104,16 @@ bool MenuBody::onTouchEnd(coord_t /*x*/, coord_t y)
void MenuBody::paint(BitmapBuffer * dc)
{
dc->clear(MENU_BGCOLOR);
dc->clear(COLOR_THEME_PRIMARY2);
for (unsigned i = 0; i < lines.size(); i++) {
auto& line = lines[i];
LcdFlags flags = MENU_COLOR | MENU_FONT;
LcdFlags flags = COLOR_THEME_SECONDARY1 | MENU_FONT;
if (selectedIndex == (int)i) {
flags = MENU_HIGHLIGHT_COLOR | MENU_FONT;
if (MENU_HIGHLIGHT_BGCOLOR != MENU_BGCOLOR) {
flags = COLOR_THEME_PRIMARY2 | MENU_FONT;
if (COLOR_THEME_FOCUS != COLOR_THEME_PRIMARY2) {
dc->drawSolidFilledRect(0, i * MENUS_LINE_HEIGHT, width(),
MENUS_LINE_HEIGHT, MENU_HIGHLIGHT_BGCOLOR);
MENUS_LINE_HEIGHT, COLOR_THEME_FOCUS);
}
}
if (line.drawLine) {
@@ -135,7 +135,7 @@ void MenuBody::paint(BitmapBuffer * dc)
if (i > 0) {
dc->drawSolidHorizontalLine(0, i * MENUS_LINE_HEIGHT, MENUS_WIDTH,
MENU_LINE_COLOR);
COLOR_THEME_SECONDARY2);
}
}
}
@@ -151,7 +151,7 @@ MenuWindowContent::MenuWindowContent(Menu* parent) :
void MenuWindowContent::paint(BitmapBuffer * dc)
{
// the background
dc->clear(MENU_BGCOLOR);
dc->clear(COLOR_THEME_PRIMARY2);
// the title
if (!title.empty()) {
@@ -159,7 +159,7 @@ void MenuWindowContent::paint(BitmapBuffer * dc)
(POPUP_HEADER_HEIGHT - getFontHeight(MENU_HEADER_FONT)) / 2,
title.c_str(), CENTERED | MENU_HEADER_FONT);
dc->drawSolidHorizontalLine(0, POPUP_HEADER_HEIGHT - 1, MENUS_WIDTH,
MENU_LINE_COLOR);
COLOR_THEME_SECONDARY2);
}
}
@@ -234,5 +234,5 @@ void Menu::paint(BitmapBuffer * dc)
r.x = toolbar->left();
r.w += toolbar->width();
}
dc->drawSolidRect(r.x - 1, r.y - 1, r.w + 2, r.h + 2, 1, MENU_LINE_COLOR);
dc->drawSolidRect(r.x - 1, r.y - 1, r.w + 2, r.h + 2, 1, COLOR_THEME_SECONDARY2);
}
+3 -3
View File
@@ -27,11 +27,11 @@ void MenuToolbarButton::paint(BitmapBuffer * dc)
MENUS_TOOLBAR_BUTTON_PADDING, MENUS_TOOLBAR_BUTTON_PADDING,
MENUS_TOOLBAR_BUTTON_WIDTH - 2 * MENUS_TOOLBAR_BUTTON_PADDING,
MENUS_TOOLBAR_BUTTON_WIDTH - 2 * MENUS_TOOLBAR_BUTTON_PADDING,
FOCUS_BGCOLOR);
COLOR_THEME_FOCUS);
dc->drawSizedText(rect.w / 2, (rect.h - getFontHeight(FONT(STD))) / 2 + 1,
&picto, 1, CENTERED | FOCUS_COLOR);
&picto, 1, CENTERED | COLOR_THEME_PRIMARY2);
} else {
dc->drawSizedText(rect.w / 2, (rect.h - getFontHeight(FONT(STD))) / 2 + 1,
&picto, 1, CENTERED | DEFAULT_COLOR);
&picto, 1, CENTERED | COLOR_THEME_SECONDARY1);
}
}
+1 -1
View File
@@ -78,7 +78,7 @@ class MenuToolbar: public FormGroup {
void paint(BitmapBuffer * dc) override
{
dc->clear(DEFAULT_BGCOLOR);
dc->clear(COLOR_THEME_SECONDARY3);
}
#if defined(HARDWARE_KEYS)
+4 -4
View File
@@ -41,12 +41,12 @@ void ModalWindow::deleteLater(bool detach, bool trash)
void ModalWindow::paint(BitmapBuffer * dc)
{
dc->drawFilledRect(0, 0, width(), height(), SOLID, OVERLAY_COLOR, OPACITY(5));
dc->drawFilledRect(0, 0, width(), height(), SOLID, COLOR_THEME_PRIMARY1, OPACITY(5));
}
void ModalWindowContent::paint(BitmapBuffer * dc)
{
dc->drawSolidFilledRect(0, 0, width(), POPUP_HEADER_HEIGHT, FOCUS_BGCOLOR);
dc->drawText(FIELD_PADDING_LEFT, (POPUP_HEADER_HEIGHT - getFontHeight(FONT(STD))) / 2, title.c_str(), FOCUS_COLOR);
dc->drawSolidFilledRect(0, POPUP_HEADER_HEIGHT, width(), height() - POPUP_HEADER_HEIGHT, DEFAULT_BGCOLOR);
dc->drawSolidFilledRect(0, 0, width(), POPUP_HEADER_HEIGHT, COLOR_THEME_FOCUS);
dc->drawText(FIELD_PADDING_LEFT, (POPUP_HEADER_HEIGHT - getFontHeight(FONT(STD))) / 2, title.c_str(), COLOR_THEME_PRIMARY2);
dc->drawSolidFilledRect(0, POPUP_HEADER_HEIGHT, width(), height() - POPUP_HEADER_HEIGHT, COLOR_THEME_SECONDARY3);
}
+4 -4
View File
@@ -36,13 +36,13 @@ void NumberEdit::paint(BitmapBuffer * dc)
LcdFlags textColor;
if (editMode)
textColor = FOCUS_COLOR;
textColor = COLOR_THEME_PRIMARY2;
else if (hasFocus())
textColor = FOCUS_COLOR;
textColor = COLOR_THEME_PRIMARY2;
// else if (enabled && (value != 0 || zeroText.empty()))
// textColor = DEFAULT_COLOR;
// textColor = COLOR_THEME_SECONDARY1;
else
textColor = DEFAULT_COLOR;
textColor = COLOR_THEME_SECONDARY1;
if (displayFunction) {
displayFunction(dc, textColor, value);
+3 -3
View File
@@ -81,9 +81,9 @@ class Roller: public Choice
while (y < yMax) {
auto displayedValue = getValueFromIndex(index);
auto fgColor = DISABLE_COLOR;
auto fgColor = COLOR_THEME_DISABLED;
if (value == displayedValue) {
fgColor = FOCUS_COLOR | FONT(STD);
fgColor = COLOR_THEME_PRIMARY2 | FONT(STD);
}
unsigned valueIndex = displayedValue - vmin;
@@ -95,7 +95,7 @@ class Roller: public Choice
}
if (windowFlags & ROLLER_SEPARATION_LINES) {
dc->drawSolidHorizontalLine(0, y - 10, width(), DISABLE_COLOR);
dc->drawSolidHorizontalLine(0, y - 10, width(), COLOR_THEME_DISABLED);
}
if (++index == valuesCount)
+1 -1
View File
@@ -30,7 +30,7 @@ class StaticText: public Window
text(std::move(text))
{
if (windowFlags & BUTTON_BACKGROUND) {
setBackgroundColor(FIELD_FRAME_COLOR);
setBackgroundColor(COLOR_THEME_SECONDARY2);
}
}
+4 -4
View File
@@ -24,7 +24,7 @@ void Table::Header::paint(BitmapBuffer * dc)
{
coord_t x = 10;
if (!cells.empty()) {
dc->clear(TABLE_HEADER_BGCOLOR);
dc->clear(COLOR_THEME_FOCUS);
for (unsigned i = 0; i < cells.size(); i++) {
auto cell = cells[i];
if (cell) {
@@ -61,15 +61,15 @@ void Table::Body::paint(BitmapBuffer * dc)
{
coord_t y = 0;
int index = 0;
dc->clear(DEFAULT_BGCOLOR);
dc->clear(COLOR_THEME_SECONDARY3);
for (auto line: lines) {
bool highlight = (index == selection);
dc->drawSolidFilledRect(0, y, width(), TABLE_LINE_HEIGHT - 2, highlight ? MENU_HIGHLIGHT_BGCOLOR : TABLE_BGCOLOR);
dc->drawSolidFilledRect(0, y, width(), TABLE_LINE_HEIGHT - 2, highlight ? COLOR_THEME_FOCUS : COLOR_THEME_SECONDARY3);
coord_t x = 10;
for (unsigned i = 0; i < line->cells.size(); i++) {
auto cell = line->cells[i];
if (cell) {
cell->paint(dc, x, y, line->flags + (highlight ? MENU_HIGHLIGHT_COLOR - COLOR_MASK(line->flags) : DEFAULT_COLOR));
cell->paint(dc, x, y, line->flags + (highlight ? COLOR_THEME_PRIMARY2 - COLOR_MASK(line->flags) : COLOR_THEME_SECONDARY1));
}
x += static_cast<Table *>(parent)->columnsWidth[i];
}
+8 -8
View File
@@ -48,34 +48,34 @@ void TextEdit::paint(BitmapBuffer * dc)
if (editMode) {
dc->drawSizedText(FIELD_PADDING_LEFT, FIELD_PADDING_TOP, value, length,
FOCUS_COLOR);
COLOR_THEME_PRIMARY2);
coord_t left = (cursorPos == 0 ? 0 : getTextWidth(value, cursorPos));
#if defined(SOFTWARE_KEYBOARD)
dc->drawSolidFilledRect(left + 2, 2, 2, height() - 4, FOCUS_COLOR);
dc->drawSolidFilledRect(left + 2, 2, 2, height() - 4, COLOR_THEME_PRIMARY2);
#else
char s[] = {value[cursorPos], '\0'};
dc->drawSolidFilledRect(FIELD_PADDING_LEFT + left - 1,
FIELD_PADDING_TOP - 1, getTextWidth(s, 1) + 1,
height() - 2, FOCUS_COLOR);
height() - 2, COLOR_THEME_PRIMARY2);
dc->drawText(FIELD_PADDING_LEFT + left, FIELD_PADDING_TOP, s,
DEFAULT_COLOR);
COLOR_THEME_SECONDARY1);
#endif
} else {
const char * displayedValue = value;
LcdFlags textColor = FOCUS_COLOR;
LcdFlags textColor = COLOR_THEME_PRIMARY2;
if (hasFocus()) {
if (strlen(value) == 0) {
displayedValue = "---";
}
textColor = FOCUS_COLOR;
textColor = COLOR_THEME_PRIMARY2;
}
else {
if (strlen(value) == 0) {
displayedValue = "---";
textColor = DISABLE_COLOR;
textColor = COLOR_THEME_DISABLED;
}
else {
textColor = DEFAULT_COLOR;
textColor = COLOR_THEME_SECONDARY1;
}
}
dc->drawSizedText(FIELD_PADDING_LEFT, FIELD_PADDING_TOP, displayedValue, length, textColor);
+2 -2
View File
@@ -520,7 +520,7 @@ void Window::drawVerticalScrollbar(BitmapBuffer * dc)
yhgt = 15;
if (yhgt + yofs > rect.h)
yhgt = rect.h - yofs;
dc->drawSolidFilledRect(rect.w - SCROLLBAR_WIDTH, scrollPositionY + yofs, SCROLLBAR_WIDTH, yhgt, SCROLLBAR_COLOR);
dc->drawSolidFilledRect(rect.w - SCROLLBAR_WIDTH, scrollPositionY + yofs, SCROLLBAR_WIDTH, yhgt, COLOR_THEME_PRIMARY3);
}
}
@@ -533,6 +533,6 @@ void Window::drawHorizontalScrollbar(BitmapBuffer * dc)
xwdth = 15;
if (xwdth + xofs > rect.w)
xwdth = rect.w - xofs;
dc->drawSolidFilledRect(scrollPositionX + xofs, rect.h - SCROLLBAR_WIDTH, xwdth, SCROLLBAR_WIDTH, SCROLLBAR_COLOR);
dc->drawSolidFilledRect(scrollPositionX + xofs, rect.h - SCROLLBAR_WIDTH, xwdth, SCROLLBAR_WIDTH, COLOR_THEME_PRIMARY3);
}
}