Skip to content

Add user-facing dark mode with config-driven toggle#360

Open
Quidney wants to merge 5 commits into
erickutcher:masterfrom
Quidney:master
Open

Add user-facing dark mode with config-driven toggle#360
Quidney wants to merge 5 commits into
erickutcher:masterfrom
Quidney:master

Conversation

@Quidney
Copy link
Copy Markdown

@Quidney Quidney commented Apr 17, 2026

This adds a complete dark mode implementation driven by a config setting rather than the existing dark_mode marker file approach.

Changes:
The core change is a DM_COLOR_SET struct that stores dark mode colors independently from the active cfg_* color variables. This means light and dark palettes are fully separated — toggling dark mode never overwrites the user's light theme customizations, and vice versa. The swap happens transparently at startup and save time.

A new "Enable dark mode (requires restart)" checkbox is added to the Appearance tab. It persists through the binary config file (bumped to version 0x0B) and prompts the user to relaunch when changed. The checkbox is grayed out on OS versions below Windows 10 1809.

Dark theming is applied to the folder browser dialog, URL drop window border, ChooseColor picker, SFTP fingerprint/key list views, and toolbar icons (pixel-inverted at load time, preserving the magenta mask).

The first commit is a standalone build fix for newer Windows SDK headers.

Testing:
Fresh install: dark mode enabled by default, all colors correct
Enable → restart → disable → restart: light colors fully restored
Config migration: older config files (version < 0x0A) load fine, dark mode defaults to enabled on first run
Verified on Windows 11 25H2

Quidney added 5 commits April 17, 2026 20:12
Add include guards for SCH_CREDENTIALS_VERSION, SP_PROT_TLS1_*, and ITaskbarList3 that newer SDK versions already define. Replace afxres.h with winresrc.h in the .rc file so it compiles without the full MFC/ATL headers installed. Provide intrinsic memset/memcpy in lite_ntdll.cpp since the CRT is excluded and the compiler emits calls for struct initialization. Move ENABLE_DARK_MODE out of the vcproj preprocessor definitions into dark_mode.h where it belongs.
Introduces DM_COLOR_SET to store dark mode colors separately from the active cfg_* variables, so user-customized light mode colors are never lost when switching themes.

At startup, light colors are loaded from config into cfg_*, then backed up before swapping in the dark palette. On save, the process reverses so the config file always contains proper light mode values.

Dark mode is now driven by cfg_enable_dark_mode in the config file (version >= 0x0A) instead of requiring a marker file on disk. The dark color set itself is persisted at version >= 0x0B. Also renames DWMWA_USE_IMMERSIVE_DARK_MODE to g_DWMWA_USE_IMMERSIVE_DARK_MODE and enables ENABLE_DARK_MODE unconditionally in dark_mode.h.
Apply dark title bar, explorer theme, and child control theming to the folder browser (SHBrowseForFolder) via a BFFM_INITIALIZED callback, the URL drop window border using dm_color_window_border, and the SFTP fingerprint/key host list views — replacing hardcoded black and white with dm_color_window_background and dm_color_window_text.
Adds an 'Enable dark mode (requires restart)' checkbox to the Appearance tab, disabled on OS versions below Win10 1809. When the setting changes, the user is prompted to restart and the app relaunches itself with the same command line arguments.

Also hooks all three ChooseColor dialogs so the color picker gets a dark title bar and themed controls, and inverts toolbar icon pixels at load time while preserving the magenta transparency mask.
New installations without an existing config file will start with dark mode enabled. Existing users keep whatever they had saved.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant