@@ -747,6 +747,38 @@ pub fn run() {
747747 }
748748 }
749749
750+ // set title bar color only when building for Windows
751+ #[ cfg( target_os = "windows" ) ]
752+ {
753+ use windows:: Win32 :: Foundation :: COLORREF ;
754+ use windows:: Win32 :: Graphics :: Dwm :: {
755+ DwmSetWindowAttribute , DWMWA_CAPTION_COLOR ,
756+ DWMWA_USE_IMMERSIVE_DARK_MODE ,
757+ } ;
758+
759+ let hwnd = window. hwnd ( ) . unwrap ( ) ;
760+
761+ unsafe {
762+ // enable dark mode for title bar text/buttons
763+ let use_dark_mode: i32 = 1 ;
764+ let _ = DwmSetWindowAttribute (
765+ hwnd,
766+ DWMWA_USE_IMMERSIVE_DARK_MODE ,
767+ & use_dark_mode as * const i32 as * const std:: ffi:: c_void ,
768+ std:: mem:: size_of :: < i32 > ( ) as u32 ,
769+ ) ;
770+
771+ // RGB(20, 26, 39) -> COLORREF 0x00BBGGRR = 0x00271A14
772+ let caption_color = COLORREF ( 0x00271A14 ) ;
773+ let _ = DwmSetWindowAttribute (
774+ hwnd,
775+ DWMWA_CAPTION_COLOR ,
776+ & caption_color as * const COLORREF as * const std:: ffi:: c_void ,
777+ std:: mem:: size_of :: < COLORREF > ( ) as u32 ,
778+ ) ;
779+ }
780+ }
781+
750782 let client: HelixClient < ' static , reqwest:: Client > =
751783 twitch_api:: HelixClient :: with_client (
752784 ClientDefault :: default_client_with_name ( Some (
0 commit comments