Merge pull request #12 from jfrickmann/CustomizableColorScheme

OS theme colors as suggested by JimB40 in #506 #540
This commit is contained in:
Raphael Coeffic
2021-08-22 09:28:03 +02:00
committed by GitHub
16 changed files with 77 additions and 76 deletions
+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);