HeaderPane
Main
Hide
Share Link
Print

Dark Mode

SftDate/OCX 2.0 supports dark mode. By default the controls use the light palette (darkSftDateOff). An application opts in by setting the DarkMode property (DarkMode, DarkMode) to darkSftDateAuto, so the control follows the Windows "Choose your mode" setting, or maintains its own Light / Dark setting and switches each control using darkSftDateOn and darkSftDateOff.

What changes in dark mode: the default colors of the field, its buttons, its check box and its dropdown, and of the calendar's days, titles, buttons and selection are replaced by their dark-palette counterparts, and the free-form text box and the tooltips follow. The field uses the dark variants of the Windows themes; the calendar has no dark theme and is drawn in its built-in style.

The DarkMode property has three values (see SftDateDarkModeConstants):

darkSftDateOff (default)Always use the light palette, regardless of the Windows setting. Useful when the application does not yet support dark mode end-to-end and mixing dark and light controls would look wrong.
darkSftDateOnAlways use the dark palette, regardless of the Windows setting. Useful when the hosting application has its own Light / Dark setting and wants the controls to follow it.
darkSftDateAutoFollow the Windows "Choose your mode" setting. The control redraws when it learns about a change of the setting (see Following the Windows Setting below) and raises the DarkModeChange event.

The DarkModeActive property (DarkModeActive, DarkModeActive) reports whether the dark palette is currently in effect; while high contrast is in effect for the control (HighContrastActive), it returns False.

The DarkModeChange event (DarkModeChange, DarkModeChange) occurs each time the active dark mode state changes because of the Windows setting (darkSftDateAuto only), so the application can repaint its own user interface around the control and set its own colors for the new mode. Its Active parameter (e.active in .NET) is the new state.

sftDate1.DarkMode = SftDateDarkModeConstants.darkSftDateAuto;
sftCalendar1.DarkMode = SftDateDarkModeConstants.darkSftDateAuto;

Following the Windows Setting

With darkSftDateAuto, a control takes the Windows setting when its window is created. It follows a change while the application runs when its container passes the WM_SETTINGCHANGE message on to it, as MFC dialogs and frame windows do; setting the DarkMode property again also makes it read the Windows setting anew.

Colors

Colors defined by the application with the color properties, special dates and the DayFormatting event are still used in dark mode - the control does not override application-chosen colors. Only the default colors (-1, colorSftDateDefault) are replaced by their dark-palette counterparts; a Windows system color set by the application is used with its current value. 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), or define the colors again when the mode changes (see Colors).

Pictures, such as the pictures of special dates, are drawn as defined in both modes.

Dark mode and Windows High Contrast are independent. If both are active, high contrast takes precedence (see High Contrast).

The Form or Dialog

The controls follow the dark mode setting at the control level. The form or dialog around them - title bar, background, labels, group boxes and the other controls placed alongside the controls - is the application's to switch. The DemoSample in C# and VB.NET sets its own calendar colors for each mode in the DarkModeChange event. The VC++ samples use the SftDarkMode.h header installed with SftDate/OCX, which handles the dialog's title bar, its background, its standard controls and the Windows "Choose your mode" setting: SftDarkMode_Init at startup, SftDarkMode_ApplyToDialog in OnInitDialog and SftDarkMode_HandleDialogMessage in the dialog's OnWndMsg.

Platform note: Dark mode requires Windows 10 or later.


Last Updated 11/29/2026 - (email)
© 2026 Softel vdm, Inc.