Aegisub icon indicating copy to clipboard operation
Aegisub copied to clipboard

Dark mode

Open vertigo220 opened this issue 11 months ago • 10 comments

A dark mode would be very welcome for this app, especially since it's typically being used while watching videos, which is often done in the dark. Having to switch back and forth between a dark video and (this) bright white app is jarring.

vertigo220 avatar Jan 20 '25 00:01 vertigo220

As someone aligned with the light, I believe I have the authority to highly recommend you flick on the light switch rather than author subtitles in the dark.

LightArrowsEXE avatar Jan 20 '25 00:01 LightArrowsEXE

This currently would require wxwidgets to release a new stable version, since they have landed "dark mode" code a while ago but it's not in any release as of now.

witchymary avatar Jan 20 '25 01:01 witchymary

We've been looking to bump the wx version for a while, but obviously only to stables.

CoffeeFlux avatar Jan 20 '25 01:01 CoffeeFlux

I'll take this opportunity to explain the Dark Mode situation in detail.

Of course, we are all aware that a dark mode is a highly requested feature. However, it needs to be emphasized that until very recently this was simply not possible on Windows.

Why is/was it not possible to add a dark mode when so many other applications already have one?

Different applications use different libraries and frameworks to draw their GUI. Libraries using other frameworks like Gtk or Qt (or frameworks for other languages like Avalonia, Electron, etc) may have much better support for dark mode, usually because they draw their UI elements manually instead of using Windows's native UI elements.

Aegisub, however, uses wxWidgets, which uses native UI elements where available (i.e. on Windows and Mac). The native Windows UI simply does not support a dark mode. (More precisely, it does not support it officially, and only unofficially supports it in a limited capacity since a few years ago, but to better explain the situation "does not support" is a helpful simplification.) So there is (or was) nothing wxWidgets could do to support a dark mode, and thus also nothing that Aegisub can do to support a dark mode. See also https://github.com/wxWidgets/wxWidgets/issues/19223 for more information.

Of course, in theory Aegisub could be ported to instead use a different UI framework like Gtk or Qt, but this would be a massive undertaking that entails rewriting the majority of the application. For a program that struggled to even get any maintainership at all throughout the last decade, this is not an option.

I want to make this fact very clear. The reason why Aegisub does not have a dark mode is because it is not (yet) possible to add one. If adding a dark mode was as simple as typing EnableDarkMode(); in the code, we'd have done it already. (This is not a joke! It may very well become (almost) that simple in the future, and at that point we can add it, see below).

Another thing to note is that all this is only limited to Windows. Dark mode works perfectly fine on MacOS and Linux via system-wide themes.

So what changed about this recently?

With the 2018 Windows 10 update, a dark theme was added to the Windows Explorer. To facilitate this, Microsoft added APIs to its UI framework to enable this dark theme. However, these APIs are undocumented and hence unsupported. This means that there is no guarantee that these APIs will continue to work in the future (nor that they even work at the moment), and they could be removed at any point in time. Furthermore, they are also very limited, since Microsoft only added the functions necessary to add a dark theme to the explorer, and not to any of its other standard applications. (In particular it is still valid to say that dark mode is unsupported on Windows).

Due to this, wxWidgets is currently working on adding experimental dark mode support that uses these APIs. However, due to the issues described above this has all kinds of quirks and inconsistencies and needs a lot of manual work to work around the limitations of Microsoft's APIs. See e.g. their blog post for more information.

Furthermore, this dark mode support in wxWidgets is still not part of a stable wxWidgets release. It's set to be included in wxWidgets 3.3.0 (for context, Aegisub currently uses 3.1.4 on Windows while only requiring 3.0.0 on Linux and will probably be bumped to 3.2.0 soon (the latest Debian stable shipping 3.2.1)), but that is not out yet. Even when it is out, making Aegisub support dark mode requires updating wxWidgets to that version, which carries its own complications (like subtle breakage in user interfaces) with it.

When working on my own fork arch1t3cht/Aegisub before official Aegisub was revived, I (or rather sepro, who PR'd this) provided experimental dark mode support by shipping two Aegisub versions for Windows, one with wxWidgets 3.1.4 and one with wxWidgets master. (And the master version needed some manual code patches to avoid broken rendering in the subtitle grid - that's an example of the complications that come with updating!) That also means that for now you can install that version if you really need a dark mode.

So, as a summary, Aegisub will probably support dark mode on Windows at some point in the future, but various things outside of its control need to happen first (as well as a good bit of work on Aegisub itself). The current lack of a dark mode is not because of a lack of interest, but because it was simply not possible before.

arch1t3cht avatar Jan 21 '25 14:01 arch1t3cht

I'll take this opportunity to explain the Dark Mode situation in detail.

TL;DR - yet another reason to switch to Linux due to M$ half-assing things yet again

vertigo220 avatar Jan 22 '25 00:01 vertigo220

To clarify a point made by arch1t3cht: Win32 dark mode is achievable on Windows 10 1809+ (which is more than 6 years old so I wouldn't call it “recently”). Notepad++ v8 and wxWidgets 3.3 demonstrate this possibility. However, it’s important to highlight the significant effort involved. While wxWidgets' dark mode was developed incrementally over numerous commits, Notepad++ provides a more illustrative example. Their initial dark mode implementation in 2021 was achieved through custom drawing, which means they had to take over all signal (mostly undocumented) and graphics rendering themselves, which is a substantial undertaking.

Ideally, dark mode should be implemented by wxWidgets upstream. If we were to implement it locally with the latest stable version of wxWidgets (3.2), we would face two undesirable options: 1. thousands of lines of Windows-specific code to create derived controls; and 2. applying extensive patches to wxWidgets 3.2 during Aegisub builds. Both approaches represent a massive and lengthy undertaking requiring significant expertise and effort.

As a side note, having briefly explored the second approach in my own fork to implement dark mode for a limited set of controls, I found maintaining these patches to be a complete nightmare.

0tkl avatar Jan 25 '25 09:01 0tkl

Another thing to note is that all this is only limited to Windows. Dark mode works perfectly fine on MacOS and Linux via system-wide themes.

I'm on Ubuntu Mate, am I missing something? My other apps are fully dark-themed as they inherit the system settings. Aeigub has dark menu, but the rest is still light theme.

Image

fmmagalhaes avatar Mar 10 '25 00:03 fmmagalhaes

You'll need to specify the colors for these elements yourself in the settings.

FichteFoll avatar Mar 10 '25 00:03 FichteFoll

Or check here: https://sgt0.github.io/aegisub-themes/

witchymary avatar Mar 10 '25 03:03 witchymary

Or check here: https://sgt0.github.io/aegisub-themes/

Thanks, that helps!

fmmagalhaes avatar Mar 10 '25 18:03 fmmagalhaes