From 864394b40a7599a1560782226168cd6e40244c5a Mon Sep 17 00:00:00 2001 From: Cem Aksoylar Date: Sun, 14 May 2023 12:20:24 -0700 Subject: [PATCH] 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. --- app/src/display/Kconfig | 7 +++++++ app/src/display/main.c | 3 ++- docs/docs/config/displays.md | 3 +++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/app/src/display/Kconfig b/app/src/display/Kconfig index 5f67bf11..63ba968b 100644 --- a/app/src/display/Kconfig +++ b/app/src/display/Kconfig @@ -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 diff --git a/app/src/display/main.c b/app/src/display/main.c index e34f8a53..e15e2de0 100644 --- a/app/src/display/main.c +++ b/app/src/display/main.c @@ -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; diff --git a/docs/docs/config/displays.md b/docs/docs/config/displays.md index d126e38a..a68bf26a 100644 --- a/docs/docs/config/displays.md +++ b/docs/docs/config/displays.md @@ -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 |