Skip to content

Commit

Permalink
feat(display): Add setting to invert display colors
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
caksoylar authored and petejohanson committed May 22, 2023
1 parent 7e29166 commit 864394b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
7 changes: 7 additions & 0 deletions app/src/display/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 2 additions & 1 deletion app/src/display/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 3 additions & 0 deletions docs/docs/config/displays.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down

0 comments on commit 864394b

Please sign in to comment.