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>
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: - Dark title bar, menu bar, context menus (via system dark mode APIs) - Dark toolbar, rebar, status bar with darkmodelib subclassing - Dark tooltips and scrollbars - All dialogs automatically themed via WH_CALLWNDPROCRET hook on WM_INITDIALOG (no per-dialog-proc changes needed) - Toolbar Customize dialog fixed with temporary SetSysColors override - Custom color hierarchy for visual depth: Editor #1E1E1E / Dialogs #252526 / Toolbar #2D2D2D / Controls #383838 - View colors for list boxes, list views, tree views, and headers - Theme switching via View > Style Theme toggles dark mode on/off - WM_SETTINGCHANGE handled for system dark/light mode changes Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Upstream win32-darkmodelib was updated with several commits including a breaking rename: - 9573105: DarkModeSubclass -> Darkmodelib, namespace DarkMode -> dmlib - Multiple tab/up-down/combo polish commits - Fix warnings, clang-tidy cleanup Updates: - Renamed darkmodelib/DarkModeSubclass.h/cpp -> Darkmodelib.h/cpp - Updated src/DarkMode.cpp and src/Notepad4.cpp: - #include "DarkModeSubclass.h" -> #include "Darkmodelib.h" - DarkMode:: -> dmlib:: - Updated build/VisualStudio/Notepad4.vcxproj file references - Refreshed all other darkmodelib files from upstream MinGW Makefile uses wildcards so no makefile change needed. 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. |




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: