`prefers-color-scheme` doesn't obey system theme
Returns true for light and false for dark when system is set to dark.
Vanilla CEF that ships with the game works fine.
Windows 10 21H2
It sure doesn't! That's weird. I'll look into it.
Okay, not sure why this is an issue, but I think it's a problem in CEF/Chromium, not us.
I spent a bunch of time digging through the code; it might be because we're running "Windowless" (offscreen-rendering/OSR), but it works in CEFClient with OSR turned on, so I'm honestly not sure.
I re-implemented the OS dark mode check for Windows and macOS with a hacky workaround, so it should work there now if you launch GMod when your OS theme is already set to dark mode. But if you change it with GMod already open, it won't update. At least for now.
Note for when I fix it for Linux: https://source.chromium.org/chromium/chromium/src/+/main:chrome/browser/ui/views/dark_mode_manager_linux.cc
Windows
The root cause of the issue is that gmod.exe doesn't have an app.manifest that enables Windows 10 compatibility. To fix it, you need to embed the following app.manifest into gmod.exe:
<?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<!-- ... anything else -->
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- Windows 10 -->
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
</application>
</compatibility>
</assembly>
To embed it, use mt.exe tool:
mt -manifest app.manifest -outputresource:"gmod.exe";#1
macOS
If using SDKs before macOS 10.14, see https://github.com/electron/electron/issues/15540#issuecomment-517895928 and https://developer.apple.com/documentation/appkit/choosing-a-specific-appearance-for-your-macos-app. I'm unable to test it, I don't have macOS device.
Not sure about Linux, I'm only able to test and fix this issue on Windows