feat(display): Add setting to invert display colors

Add CONFIG_ZMK_DISPLAY_INVERT Kconfig to invert colors
(black-on-white to white-on-black) on monochrome screens.
Currently applies only if CONFIG_LV_USE_THEME_MONO is selected,
which is the default unless user overrides it.
This commit is contained in:
Cem Aksoylar 2023-05-14 12:20:24 -07:00 committed by Pete Johanson
parent 7e29166c6c
commit 864394b40a
3 changed files with 12 additions and 1 deletions

View file

@ -15,6 +15,13 @@ config ZMK_DISPLAY_BLANK_ON_IDLE
bool "Blank display on idle"
default y if SSD1306
if LV_USE_THEME_MONO
config ZMK_DISPLAY_INVERT
bool "Invert display colors"
endif
choice LV_TXT_ENC
default LV_TXT_ENC_UTF8

View file

@ -91,7 +91,8 @@ int zmk_display_is_initialized() { return initialized; }
static void initialize_theme() {
#if IS_ENABLED(CONFIG_LV_USE_THEME_MONO)
lv_disp_t *disp = lv_disp_get_default();
lv_theme_t *theme = lv_theme_mono_init(disp, false, CONFIG_LV_FONT_DEFAULT);
lv_theme_t *theme =
lv_theme_mono_init(disp, IS_ENABLED(CONFIG_ZMK_DISPLAY_INVERT), CONFIG_LV_FONT_DEFAULT);
theme->font_small = CONFIG_ZMK_LV_FONT_DEFAULT_SMALL;
disp->theme = theme;

View file

@ -17,12 +17,15 @@ Definition files:
| Config | Type | Description | Default |
| -------------------------------------------------- | ---- | -------------------------------------------------------------- | ------- |
| `CONFIG_ZMK_DISPLAY` | bool | Enable support for displays | n |
| `CONFIG_ZMK_DISPLAY_INVERT` | bool | Invert display colors from black-on-white to white-on-black | n |
| `CONFIG_ZMK_WIDGET_LAYER_STATUS` | bool | Enable a widget to show the highest, active layer | y |
| `CONFIG_ZMK_WIDGET_BATTERY_STATUS` | bool | Enable a widget to show battery charge information | y |
| `CONFIG_ZMK_WIDGET_BATTERY_STATUS_SHOW_PERCENTAGE` | bool | If battery widget is enabled, show percentage instead of icons | n |
| `CONFIG_ZMK_WIDGET_OUTPUT_STATUS` | bool | Enable a widget to show the current output (USB/BLE) | y |
| `CONFIG_ZMK_WIDGET_WPM_STATUS` | bool | Enable a widget to show words per minute | n |
Note that `CONFIG_ZMK_DISPLAY_INVERT` setting might not work as expected with custom status screens that utilize images.
If `CONFIG_ZMK_DISPLAY` is enabled, exactly zero or one of the following options must be set to `y`. The first option is used if none are set.
| Config | Description |