From 6a0e9089b4ae6c0a2f82698ece09016b37b80eaf Mon Sep 17 00:00:00 2001 From: Alexander Lobas Date: Thu, 12 Feb 2026 22:38:37 +0100 Subject: [PATCH] IJPL-234117 Islands Darcula: Add the theme + migration GitOrigin-RevId: 3e355772bcfb24428af800b9b0a6f88da42951f6 --- .../src/com/intellij/ide/ui/LafManager.java | 5 +++++ .../intellij/platform/ide/bootstrap/Islands.kt | 18 +++++++++++------- .../com/intellij/ide/ui/laf/LafManagerImpl.kt | 5 +++++ 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/platform/platform-api/src/com/intellij/ide/ui/LafManager.java b/platform/platform-api/src/com/intellij/ide/ui/LafManager.java index 9c6851bd253c..cc1ffc09a931 100644 --- a/platform/platform-api/src/com/intellij/ide/ui/LafManager.java +++ b/platform/platform-api/src/com/intellij/ide/ui/LafManager.java @@ -75,6 +75,11 @@ public abstract class LafManager { public abstract boolean getAutodetectSupported(); + @ApiStatus.Internal + public @Nullable String getPreferredDarkThemeId() { + return null; + } + public abstract void setPreferredDarkLaf(@NotNull UIThemeLookAndFeelInfo value); public abstract void setPreferredLightLaf(@NotNull UIThemeLookAndFeelInfo value); diff --git a/platform/platform-impl/bootstrap/src/com/intellij/platform/ide/bootstrap/Islands.kt b/platform/platform-impl/bootstrap/src/com/intellij/platform/ide/bootstrap/Islands.kt index 625a4a3a6d0a..23970ed58be0 100644 --- a/platform/platform-impl/bootstrap/src/com/intellij/platform/ide/bootstrap/Islands.kt +++ b/platform/platform-impl/bootstrap/src/com/intellij/platform/ide/bootstrap/Islands.kt @@ -146,21 +146,25 @@ private suspend fun enableIslandsDarcula(properties: PropertiesComponent) { properties.setValue("ide.islands.new.darcula", true) - val lafManager = serviceAsync() - val currentTheme = lafManager.currentUIThemeLookAndFeel?.id ?: return - - if (currentTheme != "Darcula") { - return - } - val id = PluginId.getId("com.intellij.classic.ui") if (PluginManagerCore.findPlugin(id) != null && !PluginManagerCore.isDisabled(id)) { return } + val lafManager = serviceAsync() + val currentTheme = lafManager.currentUIThemeLookAndFeel?.id ?: return + val themeManager = serviceAsync() val newTheme = themeManager.findThemeById("Islands Darcula") ?: return + if (currentTheme != "Darcula") { + if (lafManager.autodetect && JBColor.isBright() && lafManager.preferredDarkThemeId == "Darcula") { + lafManager.setPreferredDarkLaf(newTheme) + } + return + } + lafManager.setCurrentLookAndFeel(newTheme, true) + lafManager.setPreferredDarkLaf(newTheme) lafManager.updateUI() } \ No newline at end of file diff --git a/platform/platform-impl/src/com/intellij/ide/ui/laf/LafManagerImpl.kt b/platform/platform-impl/src/com/intellij/ide/ui/laf/LafManagerImpl.kt index 4b8b120dd71d..03fa215bb6db 100644 --- a/platform/platform-impl/src/com/intellij/ide/ui/laf/LafManagerImpl.kt +++ b/platform/platform-impl/src/com/intellij/ide/ui/laf/LafManagerImpl.kt @@ -964,6 +964,11 @@ class LafManagerImpl(private val coroutineScope: CoroutineScope) : LafManager(), return result } + @Internal + override fun getPreferredDarkThemeId(): String? { + return preferredDarkThemeId + } + override fun setPreferredDarkLaf(value: UIThemeLookAndFeelInfo) { preferredDarkThemeId = value.id }