HeaderPane
Main
Hide
Share Link
Print

Colors

All colors of the controls can be defined by the application with SftDate_SetColor; SftDate_GetColor returns them. A color left at SFTDATE_NOCOLOR (the default) uses the matching Windows system color, or its dark mode counterpart while dark mode is active (see Dark Mode). While Windows High Contrast is active, the colors of the user's contrast theme are used instead (see High Contrast).

A color is an RGB value or a Windows system color index with the high-order bit set, such as COLOR_HIGHLIGHT | 0x80000000. A system color follows dark mode like the default colors; an RGB value is used as given.

SftDate_SetColor(hwndCalendar, SFTDATE_COLOR_TITLEBACK, RGB(0, 95, 115));
SftDate_SetColor(hwndCalendar, SFTDATE_COLOR_TITLEFORE, RGB(255, 255, 255));
SftDate_SetColor(hwndCalendar, SFTDATE_COLOR_SELECTEDBACK, COLOR_HOTLIGHT | 0x80000000);

Field Colors

These colors apply to an SftDate control:

IndexDescription
SFTDATE_COLOR_FIELDBACK, SFTDATE_COLOR_FIELDFOREThe background and text colors of the field.
SFTDATE_COLOR_SEGMENTBACK, SFTDATE_COLOR_SEGMENTFOREThe colors of the part of the value being edited.
SFTDATE_COLOR_PLACEHOLDERFOREThe color of the placeholder text of an empty field, of empty parts and of the value while the check box is cleared.
SFTDATE_COLOR_FIELDBORDERThe color of a SFTDATE_BORDER_FIXEDSINGLE border.

A disabled field is shown in the system colors of disabled controls, and a disabled calendar in the SFTDATE_COLOR_DISABLEDFORE color.

Calendar Colors

These colors apply to an SftCalendar control and to the dropdown calendar of an SftDate control:

IndexDescription
SFTDATE_COLOR_BACK, SFTDATE_COLOR_FOREThe background color and the color of the days.
SFTDATE_COLOR_TITLEBACK, SFTDATE_COLOR_TITLEFOREThe background color of the titles, and the color of the titles and the previous and next buttons.
SFTDATE_COLOR_DAYOFWEEKFORE, SFTDATE_COLOR_BORDERThe color of the names of the days of the week and of the line below them.
SFTDATE_COLOR_TRAILINGFOREThe color of the days of the previous and next month.
SFTDATE_COLOR_WEEKENDFOREThe color of Saturdays and Sundays; by default, they have the color of the other days.
SFTDATE_COLOR_SELECTEDBACK, SFTDATE_COLOR_SELECTEDFOREThe colors of selected days.
SFTDATE_COLOR_RANGEBACKThe background color of the days between the first and the last day of a range.
SFTDATE_COLOR_HOTBACKThe background color of the day under the mouse.
SFTDATE_COLOR_TODAYThe color of the outline of today's date.
SFTDATE_COLOR_DISABLEDFOREThe color of days that cannot be selected.
SFTDATE_COLOR_WEEKNUMBERFORE, SFTDATE_COLOR_WEEKNUMBERBACKThe colors of the week numbers.

Special dates and the NM_SFTDATE_DAYFORMATTING notification define colors for individual days (see Special Dates and Day Formatting).

Colors and Dark Mode

Colors set by the application, in RGB, are used as given in dark mode too; only the default colors and system colors follow the mode. An application that supports dark mode and sets its own colors defines a variant for each mode, and sets the colors again when the NM_SFTDATE_DARKMODE_CHANGED notification reports a change, as the DemoSample does:

static void SetColorScheme(HWND hwndCtl)
{
    BOOL fDark = SftDate_IsDarkModeActive(hwndCtl);
    SftDate_SetColor(hwndCtl, SFTDATE_COLOR_RANGEBACK, fDark ? RGB(95, 60, 20) : RGB(250, 225, 190));
    SftDate_SetColor(hwndCtl, SFTDATE_COLOR_DAYOFWEEKFORE, fDark ? RGB(110, 190, 205) : RGB(0, 95, 115));
}

case WM_NOTIFY:
    if (((LPNMHDR) lParam)->code == NM_SFTDATE_DARKMODE_CHANGED)
        SetColorScheme(((LPNMHDR) lParam)->hwndFrom);
    break;

Windows Themes

With SftDate_SetUseThemes set to TRUE (the default) and the default colors, the controls are drawn with the Windows themes of date fields and calendars. Setting a calendar's SFTDATE_COLOR_BACK, SFTDATE_COLOR_SELECTEDBACK, SFTDATE_COLOR_HOTBACK or SFTDATE_COLOR_TODAY color draws the calendar without the theme (see Using Themes).


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