diff --git a/PowerEditor/src/WinControls/ColourPicker/ColourPopup.cpp b/PowerEditor/src/WinControls/ColourPicker/ColourPopup.cpp index afcc5b215..6115b5967 100644 --- a/PowerEditor/src/WinControls/ColourPicker/ColourPopup.cpp +++ b/PowerEditor/src/WinControls/ColourPicker/ColourPopup.cpp @@ -223,7 +223,8 @@ intptr_t CALLBACK ColourPopup::run_dlgProc(UINT message, WPARAM wParam, LPARAM l cc.lpCustColors = (LPDWORD) acrCustClr; cc.rgbResult = _colour; - cc.Flags = CC_FULLOPEN | CC_RGBINIT; + cc.lpfnHook = chooseColorDlgProc; + cc.Flags = CC_FULLOPEN | CC_RGBINIT | CC_ENABLEHOOK; display(false); @@ -265,3 +266,61 @@ intptr_t CALLBACK ColourPopup::run_dlgProc(UINT message, WPARAM wParam, LPARAM l } return FALSE; } + +uintptr_t CALLBACK ColourPopup::chooseColorDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM) +{ + switch (message) + { + case WM_INITDIALOG: + { + if (NppDarkMode::isExperimentalSupported()) + { + NppDarkMode::setDarkTitleBar(hwnd); + } + NppDarkMode::autoSubclassAndThemeChildControls(hwnd); + break; + } + + case WM_CTLCOLOREDIT: + { + if (NppDarkMode::isEnabled()) + { + return NppDarkMode::onCtlColorSofter(reinterpret_cast(wParam)); + } + break; + } + + case WM_CTLCOLORLISTBOX: + case WM_CTLCOLORDLG: + case WM_CTLCOLORSTATIC: + { + if (NppDarkMode::isEnabled()) + { + return NppDarkMode::onCtlColorDarker(reinterpret_cast(wParam)); + } + break; + } + + case WM_PRINTCLIENT: + { + if (NppDarkMode::isEnabled()) + { + return TRUE; + } + break; + } + + case WM_ERASEBKGND: + { + if (NppDarkMode::isEnabled()) + { + RECT rc = {}; + ::GetClientRect(hwnd, &rc); + ::FillRect(reinterpret_cast(wParam), &rc, NppDarkMode::getDarkerBackgroundBrush()); + return TRUE; + } + break; + } + } + return FALSE; +} diff --git a/PowerEditor/src/WinControls/ColourPicker/ColourPopup.h b/PowerEditor/src/WinControls/ColourPicker/ColourPopup.h index 6f9c05631..8372a8b22 100644 --- a/PowerEditor/src/WinControls/ColourPicker/ColourPopup.h +++ b/PowerEditor/src/WinControls/ColourPicker/ColourPopup.h @@ -63,4 +63,5 @@ private : static intptr_t CALLBACK dlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); intptr_t CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam); + static uintptr_t CALLBACK chooseColorDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); };