Implement dark mode using win32-darkmodelib#1203
Conversation
|
Please wait a bit, looks I don't understand why it's need to subcalss all common controls. |
Isn't the code 8k lines? Those common controls won't render correctly in dark mode. Some part of the control will still rendering the way in light theme. E.g. buttons render as light, or some background render as light. I didn't find a simple way to fix them without subclass them. In fact notepad++ also does the same way (subclass those controls). |
It matters at least for matepath: |
matepath is a different project right? Haven't looked into support darkmode on it yet. |
|
This is a long overdue feature, it would be nice to be able to implement it. 💪🏻 |
Address PR zufuliu#1203 feedback: scroll bars and the save-changes dialog were rendered in the light theme even when dark mode is active. - Enable scroll bar fix in darkmodelib (mode 2: per-window) and rely on the existing enableDarkScrollBarForWindowAndChildren(hwndMain) call so the Scintilla edit window's scroll bars use the dark theme. - Route Notepad4's MsgBox() through dmlib::darkMessageBoxW(), which renders message boxes as themed task dialogs when dark mode is on. - Fix two upstream darkmodelib namespacing bugs that surface when _DARKMODELIB_USE_SCROLLBAR_FIX is defined (DmlibHook.cpp uses ModuleHandle / LoadFn without the dmlib_module:: prefix). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Address PR zufuliu#1203 feedback: scroll bars and the save-changes dialog were rendered in the light theme even when dark mode is active. - Enable scroll bar fix in darkmodelib (mode 2: per-window) and rely on the existing enableDarkScrollBarForWindowAndChildren(hwndMain) call so the Scintilla edit window's scroll bars use the dark theme. - Route Notepad4's MsgBox() through dmlib::darkMessageBoxW(), which renders message boxes as themed task dialogs when dark mode is on. - Fix two upstream darkmodelib namespacing bugs that surface when _DARKMODELIB_USE_SCROLLBAR_FIX is defined (DmlibHook.cpp uses ModuleHandle / LoadFn without the dmlib_module:: prefix). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Address PR zufuliu#1203 feedback: scroll bars and the save-changes dialog were rendered in the light theme even when dark mode is active. - Enable scroll bar fix in darkmodelib (mode 2: per-window) and rely on the existing enableDarkScrollBarForWindowAndChildren(hwndMain) call so the Scintilla edit window's scroll bars use the dark theme. - Route Notepad4's MsgBox() through dmlib::darkMessageBoxW(), which renders message boxes as themed task dialogs when dark mode is on. - Fix two upstream darkmodelib namespacing bugs that surface when _DARKMODELIB_USE_SCROLLBAR_FIX is defined (DmlibHook.cpp uses ModuleHandle / LoadFn without the dmlib_module:: prefix). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Great job, @lostindark it looks really nice now. Well done!
|
Address PR zufuliu#1203 feedback: scroll bars and the save-changes dialog were rendered in the light theme even when dark mode is active. - Enable scroll bar fix in darkmodelib (mode 2: per-window) and rely on the existing enableDarkScrollBarForWindowAndChildren(hwndMain) call so the Scintilla edit window's scroll bars use the dark theme. - Route Notepad4's MsgBox() through dmlib::darkMessageBoxW(), which renders message boxes as themed task dialogs when dark mode is on. - Fix two upstream darkmodelib namespacing bugs that surface when _DARKMODELIB_USE_SCROLLBAR_FIX is defined (DmlibHook.cpp uses ModuleHandle / LoadFn without the dmlib_module:: prefix). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Address PR zufuliu#1203 feedback: scroll bars and the save-changes dialog were rendered in the light theme even when dark mode is active. - Enable scroll bar fix in darkmodelib (mode 2: per-window) and rely on the existing enableDarkScrollBarForWindowAndChildren(hwndMain) call so the Scintilla edit window's scroll bars use the dark theme. - Route Notepad4's MsgBox() through dmlib::darkMessageBoxW(), which renders message boxes as themed task dialogs when dark mode is on. - Fix two upstream darkmodelib namespacing bugs that surface when _DARKMODELIB_USE_SCROLLBAR_FIX is defined (DmlibHook.cpp uses ModuleHandle / LoadFn without the dmlib_module:: prefix). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Address PR zufuliu#1203 feedback: scroll bars and the save-changes dialog were rendered in the light theme even when dark mode is active. - Enable scroll bar fix in darkmodelib (mode 2: per-window) and rely on the existing enableDarkScrollBarForWindowAndChildren(hwndMain) call so the Scintilla edit window's scroll bars use the dark theme. - Route Notepad4's MsgBox() through dmlib::darkMessageBoxW(), which renders message boxes as themed task dialogs when dark mode is on. - Fix two upstream darkmodelib namespacing bugs that surface when _DARKMODELIB_USE_SCROLLBAR_FIX is defined (DmlibHook.cpp uses ModuleHandle / LoadFn without the dmlib_module:: prefix). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Address PR zufuliu#1203 feedback so that scroll bars, message boxes, the file open/save dialog, and toolbar button rollovers all render correctly when dark mode is toggled on or off. - Enable per-window scroll bar fix in darkmodelib (mode 2) so the Scintilla edit window's scroll bars use the dark theme via the existing enableDarkScrollBarForWindowAndChildren(hwndMain) call. - Route Notepad4's MsgBox() through dmlib::darkMessageBoxW(), which renders message boxes as themed task dialogs when dark mode is on. - Broadcast WM_THEMECHANGED to hwndMain and all descendants after a theme switch so themed controls (including scroll bars) re-open their theme handles and pick up the new light/dark style. - Gate the OpenNcThemeData IAT hook on IsDarkModeActive() so scroll bars revert to the light theme after switching back from dark. - Gate the WM_INITDIALOG thread hook on isExperimentalActive() and on the dialog's HINSTANCE matching this app's module, so system dialogs hosted in our process (common file open/save, etc.) are left untouched. - Subclass the main window with setWindowNotifyCustomDrawSubclass so darkmodelib can custom-draw toolbar buttons (dark hover/checked states) via the toolbar's NM_CUSTOMDRAW notifications, which the rebar forwards up to its parent. This matches Notepad++'s approach. - Fix two upstream darkmodelib namespacing bugs that surface when _DARKMODELIB_USE_SCROLLBAR_FIX is defined (DmlibHook.cpp uses ModuleHandle / LoadFn without the dmlib_module:: prefix). - Add missing #include <string_view> in DmlibHook.cpp so MinGW GCC/Clang builds compile (upstream pulls this in via StdAfx.h which we do not vendor). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Fixed in latest commit. |
|
Appearance for default theme is not good and doesn't match system default (looks old classic theme): This change increase exe size by 93KB, I think we needs some custom/samll version of darkmodelib, at least bugprone-exception-escape warnings needs to be fixed (e.g. by not use C++ STL). |
Both issues fixed. Though the smaller version of darmodelib might be tricky. |
Vendor the win32-darkmodelib library (https://github.com/ozone10/win32-darkmodelib) under darkmodelib/, mirroring upstream's src/ + include/ layout. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Integrate darkmodelib into Notepad4: dark mode application logic (DarkMode.cpp/.h and calls from Notepad4.cpp, Styles.cpp, Dialogs.cpp), build wiring for the darkmodelib library, and the local patches to the vendored library (disableDarkScrollBarForWindowAndChildren and the light/dark toolbar theming color fixes). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Rework the integration, so the change is a bit easier to read. |
I'm still prefer custom smaller version:
deferred this to next release, I need some time to fix Markdown lexer crashes. |







Vendor ozone10/win32-darkmodelib source files directly in darkmodelib/ to provide native Windows dark mode support for Notepad4's UI chrome, tied to the existing Style Theme (Default/Dark) setting.
Features: