Mpv: Windows Dark Theme Support

Created on 30 Aug 2019  路  8Comments  路  Source: mpv-player/mpv

Hi, this is when window is active:
image

This is when it's inactive:
image

Top bar of the File Explorer is dark when window is inactive.

But with MPV, it's white when window is inactive(not focused).
image

Could you please add support for this.

feature-request win

Most helpful comment

Here's something interesting in microsoft/terminal:
https://github.com/microsoft/terminal/blob/56c35945b97f/src/interactivity/win32/windowtheme.cpp#L34-L51

It seems like Microsoft are using internal undocumented APIs (as usual) to enable these features for their first-party software. I wrote a test program to call these two functions, and it seems to work:

image

This only works in the release version of Windows 10 though. In the insiders build, it seems like these APIs are no longer enough to enable dark mode. Dark mode doesn't work for the console in the insiders build either, but it still works for Explorer.

I'd like to enable dark mode for mpv, but not while it's an internal API that changes between each release of Windows 10. (Especially not while it requires that call-by-ordinal ShouldAppsUseDarkMode API to check if dark mode is enabled or not.) Hopefully they add a public API, or at least a stable undocumented API, to the next Windows 10 release.

All 8 comments

Just to add, I think the title bar should be black if you have dark theme turned on and a compliant program while also not explicitly telling windows to use your accent colour on it.

We can see this behaviour on a few Win32 things, like the file explorer and powershell. I don't believe this should be a lot of work but I'm also not entirely sure it's properly documented. It might be part of XAML Islands.

darktitle

I think the browsers can also switch between their themes whenever you change the global windows setting, but they're drawing their own decorations.

I thought it might be a window style but it ain't.

It's likely win32 non client area custom paint or there is a function that can set it.

It was asked at stack overflow without anybody knowing the answer.

https://stackoverflow.com/questions/57124243/winforms-dark-title-bar-on-windows-10

Here's something interesting in microsoft/terminal:
https://github.com/microsoft/terminal/blob/56c35945b97f/src/interactivity/win32/windowtheme.cpp#L34-L51

It seems like Microsoft are using internal undocumented APIs (as usual) to enable these features for their first-party software. I wrote a test program to call these two functions, and it seems to work:

image

This only works in the release version of Windows 10 though. In the insiders build, it seems like these APIs are no longer enough to enable dark mode. Dark mode doesn't work for the console in the insiders build either, but it still works for Explorer.

I'd like to enable dark mode for mpv, but not while it's an internal API that changes between each release of Windows 10. (Especially not while it requires that call-by-ordinal ShouldAppsUseDarkMode API to check if dark mode is enabled or not.) Hopefully they add a public API, or at least a stable undocumented API, to the next Windows 10 release.

I've been trying out similar at https://github.com/rust-windowing/winit/pull/1217 . I'm also on insiders. After a little experimentation I found that the DwmSetWindowAttribute call works for me if I use 20 instead of 19 as the definition of DWMA_USE_IMMERSIVE_DARK_MODE. Perhaps you'll find that also is the case for you?

Accordingly, I'm considering using a build version check to switch between 19 or 20. But at the moment the only evidence that I can find that 20 works is me! (Googling for further evidence is how I've stumbled on this issue.)

Was this on insider's? @davidhewitt

In the end I went for the approach showcased in this repository, which works for most Windows 10 versions from 2018 and up: https://github.com/ysc3839/win32-darkmode

(Insiders and stable)

Hey that's perfect, that could work here too

Was this page helpful?
0 / 5 - 0 ratings