Darker title bar

This commit is contained in:
Natsumi
2026-01-05 22:39:39 +13:00
parent de01638b18
commit 0788af6161
2 changed files with 16 additions and 5 deletions

View File

@@ -37,7 +37,7 @@ namespace VRCX
PersistSessionCookies = true,
UserAgent = Program.Version,
BrowserSubprocessPath = Environment.ProcessPath,
BackgroundColor = 0xFF101010
BackgroundColor = 0xFF0A0A0A
};
cefSettings.RegisterScheme(new CefCustomScheme

View File

@@ -78,19 +78,30 @@ namespace VRCX
//Set the theme of the window
SetThemeToGlobal(form.Handle);
//Change opacity to foce full redraw
//Change opacity to force full redraw
form.Opacity = 0.99999;
form.Opacity = 1;
}
}));
}
private const int DWMWA_USE_IMMERSIVE_DARK_MODE_BEFORE_20H1 = 19;
private const int DWMWA_USE_IMMERSIVE_DARK_MODE = 20;
private const int DWMWA_CAPTION_COLOR = 35;
private static void SetThemeToGlobal(IntPtr handle)
{
int whiteColor = 0xFFFFFF;
int blackColor = 0x000000;
if (GetTheme(handle) != currentTheme)
{
if (PInvoke.DwmSetWindowAttribute(handle, 19, new[] { currentTheme }, 4) != 0)
PInvoke.DwmSetWindowAttribute(handle, 20, new[] { currentTheme }, 4);
if (PInvoke.DwmSetWindowAttribute(handle, DWMWA_USE_IMMERSIVE_DARK_MODE_BEFORE_20H1, ref currentTheme, sizeof(int)) != 0)
PInvoke.DwmSetWindowAttribute(handle, DWMWA_USE_IMMERSIVE_DARK_MODE, ref currentTheme, sizeof(int));
if (currentTheme == 1)
PInvoke.DwmSetWindowAttribute(handle, DWMWA_CAPTION_COLOR, ref blackColor, sizeof(int));
else
PInvoke.DwmSetWindowAttribute(handle, DWMWA_CAPTION_COLOR, ref whiteColor, sizeof(int));
}
}
@@ -146,7 +157,7 @@ namespace VRCX
internal static class PInvoke
{
[DllImport("DwmApi")]
internal static extern int DwmSetWindowAttribute(IntPtr hwnd, int dwAttribute, int[] pvAttribute, int cbAttribute);
internal static extern int DwmSetWindowAttribute(IntPtr hwnd, int dwAttribute, ref int pvAttribute, int cbAttribute);
[DllImport("DwmApi")]
internal static extern int DwmGetWindowAttribute(IntPtr hwnd, int dwAttribute, IntPtr pvAttribute, int cbAttribute);