@@ -19,8 +19,7 @@ use windows_sys::{
1919 Foundation :: { COLORREF , HANDLE , HWND , LPARAM , LRESULT , POINT , RECT , WAIT_FAILED , WPARAM } ,
2020 Graphics :: Gdi :: {
2121 BLACK_BRUSH , CreateSolidBrush , GetStockObject , HDC , InvalidateRect , Rectangle ,
22- ScreenToClient , SelectObject , SetBkColor , SetBkMode , SetTextColor , TRANSPARENT ,
23- WHITE_BRUSH ,
22+ ScreenToClient , SelectObject , SetBkColor , SetTextColor , WHITE_BRUSH ,
2423 } ,
2524 System :: Threading :: INFINITE ,
2625 UI :: {
@@ -42,7 +41,8 @@ use windows_sys::{
4241use super :: RUNTIME ;
4342use crate :: ui:: {
4443 darkmode:: {
45- children_refresh_dark_mode, init_dark, is_dark_mode_allowed_for_app, window_use_dark_mode,
44+ children_refresh_dark_mode, control_color_static, init_dark, is_dark_mode_allowed_for_app,
45+ window_use_dark_mode,
4646 } ,
4747 dpi:: get_dpi_for_window,
4848 font:: { WinBrush , default_font} ,
@@ -296,18 +296,7 @@ pub(crate) unsafe extern "system" fn window_proc(
296296 InvalidateRect ( handle, null ( ) , 1 ) ;
297297 }
298298 WM_CTLCOLORSTATIC => {
299- let dark = is_dark_mode_allowed_for_app ( ) ;
300- let hdc = wparam as HDC ;
301- SetBkMode ( hdc, TRANSPARENT as _ ) ;
302- if dark {
303- SetTextColor ( hdc, WHITE ) ;
304- SetBkColor ( hdc, BLACK ) ;
305- }
306- return if dark {
307- GetStockObject ( BLACK_BRUSH )
308- } else {
309- GetStockObject ( WHITE_BRUSH )
310- } as _ ;
299+ return control_color_static ( lparam as HWND , wparam as HDC ) ;
311300 }
312301 WM_CTLCOLORBTN => {
313302 if is_dark_mode_allowed_for_app ( ) {
0 commit comments