Skip to content

Windows light and dark mode - #19

Draft
jay739 wants to merge 4 commits into
mainfrom
feat/windows-dark-mode
Draft

jay739 wants to merge 4 commits into
mainfrom
feat/windows-dark-mode

Conversation

@jay739

@jay739 jay739 commented Nov 15, 2026 •

Copy link
Copy Markdown
Owner

What

The Windows app follows Windows light and dark mode, in two ways:

  • The haze: the separate Light/Dark settings macOS already has. When Windows is in dark mode and the new switch is on, OpenHaze dims with a second intensity and color instead of the normal ones.
  • The Settings window: it follows Windows light and dark mode, title bar included, or stays light or dark as chosen under System > Theme (Match Windows, Light, Dark). The Theme choice affects only this window; the haze's dark-mode values always follow Windows.

This PR collects the rest of the feature, one step a day:

  • Settings window: the switch, plus dark-mode intensity and color rows
  • Settings window: dark title bar and colors when Windows is in dark mode
  • Settings window: follow a theme change while it is open
  • Settings window: a Theme choice (Match Windows, Light, Dark), and the dark-mode rows indented under their switch
  • windows/README.md: describe both parts
  • README.md: move Light/Dark out of "macOS extras"

The groundwork already landed in #17 (the stored dark-mode values) and #18 (following the Windows theme and using those values for the haze).

The color picker and the pop-up messages (About, update prompts) are Windows' own dialogs and stay light. The tray menu is out of scope here.

Why

A dark desktop already looks dimmer, so the haze that suits a light theme is usually too strong on a dark one. macOS users can set the two apart, and Windows users could not. And a bright white Settings window on a dark desktop looks out of place next to everything else.

How it was tested

  • Existing tests pass (windows\test.bat, 15 checks), and the build has no warnings
  • New behavior is covered by a test: not in windows/tests yet, because that suite only covers the update checker. The Settings window was driven by a script against the built exe instead: the dark rows start greyed out, the switch enables them and is saved, each slider changes only its own value, the value in effect in dark mode is the dark one, and turning the switch off greys the rows again (7 of 7 pass). A second script opens the window as if Windows were light, dark, and dark with the dark rows greyed out, and checks the title bar, every button and text box, the hints, the swatches and the greyed-out labels (22 of 22 pass). A third switches Windows between light and dark underneath an open window and checks it follows both ways, stays put when a setting is saved, and stops listening once closed; after the round trip it matches a freshly opened light window pixel for pixel (19 of 19 pass). A fourth covers the Theme choice: saving and loading it (hand-edited values clamped), all six combinations of choice and Windows mode, the haze ignoring it, the three buttons switching the window live, the indented rows, and a scan that no two controls in the window overlap (19 of 19 pass). Rendering with modern visual styles caught sliders overlapping each other, and the overlap scan caught one more that dated back to the original layout
  • Docs updated if behavior changed: the two README steps above
  • Hands-on: with the new build running, flip Windows between Light and Dark in Settings > Personalization > Colors and watch the haze and the Settings window switch; then try System > Theme > Light and Dark

The Dimming group gets a "Use a different haze intensity and color when
Windows is in dark mode" switch, plus a "Dark mode" intensity slider and
color row that stay greyed out until it is on.

Each slider and color row sets its own stored value. The tray slider and
hotkeys still adjust whichever value is in effect, but here the normal
row always edits the light value, so moving it in dark mode no longer
changes the dark one. Two helpers build the slider and color rows, so
the dark rows reuse the same code.

Slider rows sit 36 px apart, because a TrackBar is 45 px tall whatever
height it is given and closer rows hide the lower slider's track. The
color rows also move clear of the Fade slider, which used to cover the
top edge of their buttons.
@jay739
jay739 force-pushed the feat/windows-dark-mode branch from e6edf85 to d22f37a Compare November 15, 2026 00:34
@jay739 jay739 changed the title Windows light and dark mode settings Windows light and dark mode Nov 15, 2026
When Windows is in dark mode as the Settings window opens, the title bar
turns dark and every control gets dark colors close to Windows 11's own
dark windows. Buttons switch to a flat style, because a standard button
ignores its background color and stays light. Hints stay dimmer than the
rest of the text, and the color swatches keep showing the haze color.

In dark mode the greyed-out "Dark mode" rows dim their labels by color
instead of disabling them, because Windows draws disabled label text with
a light shadow that smudges on a dark background.

SetDarkTitleBar tries the attribute Windows 10 version 2004 and later use,
then the one earlier Windows 10 builds used. Windows 7 and 8 reject both
and keep their normal title bar.
The Settings window now listens for the settings' Changed event while it
is open and redraws itself light or dark when Windows switches, instead of
keeping the look it opened with. Changed also fires for every setting saved
from the window, so it acts only when light or dark actually differs from
how the window is drawn, and it stops listening when the window closes.

The dark colors now come off again too: buttons go back to the standard
style, the shortcut boxes to white with the normal border, hints to the
normal grey, and greyed-out labels back to the normal disabled look.
Hints are tagged so they get the right grey both ways.

SetDarkTitleBar also asks Windows for a frame change, because Windows 10
repaints an open window's title bar only after one.
A new Theme choice in the System group of the Settings window offers
Match Windows (the default, which keeps following Windows live), Light
and Dark. The choice is saved with the other settings, and values outside
0 to 2 in a hand-edited settings.txt are clamped. UseDarkTheme combines it
with Windows' mode. It affects only OpenHaze's own window: the haze's
dark-mode intensity and color still follow Windows, because a dark desktop
needs a lighter haze whatever color the Settings window is.

The dark-mode switch in the Dimming group now sits directly above the two
rows it controls, which are indented under it, and the rows above go back
to the released order: Intensity, Fade, Haze color. Every row under a
slider now starts 48 px below its top, because a TrackBar is 45 px tall
whatever height it is given; the Intensity and Fade sliders used to
overlap by 9 px, so the upper one took clicks meant for the lower one.

This branch has not been deployed

No deployments
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