HeaderPane
Main
Hide

SftButton/DLL 3.0 - Button Control

Share Link
Print

Dark Mode

SftButton/DLL 3.0 supports dark mode. The default for new buttons is SFTBUTTON_DARKMODE_OFF (always light) to preserve visual back-compatibility for applications written before dark mode existed. Applications that want their buttons to follow the Windows 10 "Choose your mode" accessibility setting should call SetDarkMode with SFTBUTTON_DARKMODE_AUTO once at control creation, or maintain their own Light / Dark toggle and switch each button to ON / OFF as the toggle changes.

What changes in dark mode: the button background, text, border, focus ring, dropdown arrow and hover/pressed overlays all switch to dark-palette colors. Theme-driven chrome is suppressed while dark mode is active so that the button matches the control's dark palette instead of the system's light-themed push-button style.

The button control's dark mode setting has three values (see SetDarkMode):

OFF (default)Always use the light palette, regardless of the Windows setting. Preserves visual back-compatibility for applications written before dark mode existed.
ONAlways use the dark palette, regardless of the Windows setting. Useful when the hosting application has its own Light / Dark toggle and wants the button to follow it.
AUTOFollow the Windows "Choose your mode" setting. The control re-renders when the system setting flips and sends SFTBUTTONN_DARKMODE_CHANGED to the parent window.

SFTBUTTONN_DARKMODE_CHANGED is sent to the parent window each time the active dark mode state flips (AUTO mode only) so the application can repaint its own chrome around the button control. IsDarkModeActive reports the current state at any time.

Caller-supplied color overrides (per-state background colors, gradient start/end colors, text colors, border colors) are still honored in dark mode - the control does not override application-chosen colors. If you need specific buttons to stand out in dark mode, pick accent colors that read well on both a light and a dark background (mid-tone saturated values in the RGB 30-210 range tend to work in both).

Windows themes are suppressed while dark mode is active. The button's background, border and dropdown arrow fall back to the control's built-in dark-aware GDI rendering path so they match the dark palette instead of the system's light-themed button style.

Host dialog integration

The button control follows the dark mode setting at the control level. The hosting dialog itself - title bar, dialog background, static labels, group boxes, edits and any standard Win32 controls placed alongside the button - also needs to be wired into dark mode for the dialog to render coherently. The shared SftDarkMode helper provides that integration: a single header (SftDarkMode.h) used by every Softel vdm DLL product that handles dialog title bars, WM_CTLCOLOR* responses, the Windows "Choose your mode" toggle, and dark NC scrollbars on standard controls.

A typical adoption is four call sites: SftDarkMode_Init at process startup, SftDarkMode_ApplyToDialog from each WM_INITDIALOG, SftDarkMode_HandleDialogMessage routed from each dialog procedure, and an optional SftDarkMode_SetActive when the application exposes its own Light / Dark toggle.

Platform note: Dark mode requires Windows 10 or later. On earlier platforms the setting is stored but has no visual effect.


Last Updated 05/09/2026 - (email)
© 2026 Softel vdm, Inc.