Created
December 30, 2022 09:47
-
-
Save dkandalov/6a3cc9f1b6ae91e4289f01b8156a3591 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.intellij.application.subscribe | |
import com.intellij.ide.ui.LafManagerListener | |
import com.intellij.ui.Gray | |
import com.intellij.ui.JBColor | |
import com.intellij.util.ui.JBInsets | |
import javax.swing.UIManager | |
fun fixUI() { | |
// You can find more constants in: | |
// - https://github.com/JetBrains/intellij-community/blob/master/platform/util/ui/src/com/intellij/util/ui/JBUI.java | |
// - https://github.com/JetBrains/intellij-community/blob/master/platform/platform-resources/src/themes/metadata/IntelliJPlatform.themeMetadata.json | |
// - https://github.com/JetBrains/intellij-community/blob/master/platform/platform-resources/src/themes/metadata/JDK.themeMetadata.json | |
UIManager.put("RunWidget.background", Gray._55) | |
UIManager.put("RunWidget.runningBackground", Gray._55) | |
UIManager.put("ToolWindow.Header.height", 30) | |
UIManager.put("ToolWindow.Header.inactiveBackground", JBColor(Gray._244, Gray._55)) | |
UIManager.put("EditorTabs.tabInsets", JBInsets.create(0, 10)) | |
} | |
LafManagerListener.TOPIC.subscribe(pluginDisposable, LafManagerListener { fixUI() }) |
There is no easy answer anymore but finding JComponent and changing its background is always an option 🙈
import com.intellij.openapi.actionSystem.impl.ActionButtonWithText
import com.intellij.openapi.project.Project
import com.intellij.openapi.project.ProjectManagerListener
import com.intellij.openapi.wm.WindowManager
import com.intellij.ui.ComponentUtil
import com.intellij.ui.JBColor
import java.awt.Color
import javax.swing.JComponent
fun fixUI() {
WindowManager.getInstance()
.allProjectFrames.map { it.component }
.flatMap {
// Lookup via class name because MainToolbar is internal
// See https://github.com/JetBrains/intellij-community/blob/b1a1086a1c762bd7c0683a87f371c9d57e34588e/platform/platform-impl/src/com/intellij/openapi/wm/impl/headertoolbar/MainToolbar.kt#L79
val toolbarClass = this.javaClass.classLoader.loadClass("com.intellij.openapi.wm.impl.headertoolbar.MainToolbar")
ComponentUtil.findComponentsOfType(it, toolbarClass as Class<JComponent>)
}
.flatMap {
ComponentUtil.findComponentsOfType(it, ActionButtonWithText::class.java).filterNotNull()
}
.forEach {
it.background = JBColor(Color(65, 104, 207), Color(65, 104, 207))
}
}
liveplugin.registerProjectListener(pluginDisposable, object : ProjectManagerListener {
override fun projectOpened(project: Project) = fixUI()
})
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
could you please teach me how to get the previous "Run | Debug" widget with the blue accent color?
