Skip to content

INFO: Jetbrains Runtime 21 has now an API to detect the OS theme #85

@bric3

Description

@bric3

So this is not an issue report but more of a discussion or information.

It seems the latest JBR 21 build, has now an API to detect whether the OS is dark, that said, at this time the implementation seems to only support Linux.

            String[] themesOrder = {DARK_THEME_NAME, LIGHT_THEME_NAME, DARK_THEME_NAME};
            Toolkit.getDefaultToolkit().addPropertyChangeListener("awt.os.theme.isDark", evt -> {
                currentTheme = currentTheme();
            });

https://github.com/JetBrains/JetBrainsRuntime/releases/tag/jbr-release-21.0.3b453.2
JetBrains/JetBrainsRuntime@16150a0
https://youtrack.jetbrains.com/issue/JBR-6376

This is needed for Linux in the first place, but if the API can be made generic, some stuff from IDEA on macOS/Windows can be moved there as well.
See IJPL-54591 for the discussion and suggestions. There are plugins that implement this, for example, here: https://github.com/weisJ/auto-dark-mode/blob/master/linux/gtk/src/main/java/com/github/weisj/darkmode/platform/linux/gtk/GtkThemeMonitorService.kt

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions