Skip to content

Commit

Permalink
an option to change active editor tab via color scheme
Browse files Browse the repository at this point in the history
GitOrigin-RevId: b78a7426d55ea35a19966127c8d8adf6cd1919ab
  • Loading branch information
bulenkov authored and intellij-monorepo-bot committed Oct 1, 2019
1 parent 2c21688 commit bf26eb8
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ public interface EditorColors {
ColorKey SCROLLBAR_THUMB_COLOR = ColorKey.createColorKey(SystemInfo.isMac ? "ScrollBar.Mac.thumbColor" : "ScrollBar.thumbColor");
ColorKey SCROLLBAR_THUMB_WHILE_SCROLLING_COLOR = ColorKey.createColorKey(SystemInfo.isMac ? "ScrollBar.Mac.hoverThumbColor" : "ScrollBar.hoverThumbColor");

TextAttributesKey TAB_SELECTED = TextAttributesKey.createTextAttributesKey("TAB_SELECTED");
TextAttributesKey TAB_SELECTED_INACTIVE = TextAttributesKey.createTextAttributesKey("TAB_SELECTED_INACTIVE");
ColorKey TAB_UNDERLINE = ColorKey.createColorKey("TAB_UNDERLINE");
ColorKey TAB_UNDERLINE_INACTIVE = ColorKey.createColorKey("TAB_UNDERLINE_INACTIVE");

TextAttributesKey REFERENCE_HYPERLINK_COLOR = TextAttributesKey.createTextAttributesKey("CTRL_CLICKABLE", new TextAttributes(JBColor.blue, null, JBColor.blue, EffectType.LINE_UNDERSCORE,
Font.PLAIN));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@ public class GeneralColorsPage implements ColorSettingsPage, InspectionColorSett
new AttributesDescriptor(OptionsBundle.message("options.general.color.descriptor.breadcrumbs.current"), EditorColors.BREADCRUMBS_CURRENT),
new AttributesDescriptor(OptionsBundle.message("options.general.color.descriptor.breadcrumbs.inactive"), EditorColors.BREADCRUMBS_INACTIVE),

new AttributesDescriptor(OptionsBundle.message("options.general.color.descriptor.tabs.selected.tab"), EditorColors.TAB_SELECTED),
new AttributesDescriptor(OptionsBundle.message("options.general.color.descriptor.tabs.selected.tab.inactive"), EditorColors.TAB_SELECTED_INACTIVE),

new AttributesDescriptor(OptionsBundle.message("options.general.color.descriptor.popups.lens"), EditorColors.CODE_LENS_BORDER_COLOR)
};

Expand All @@ -120,6 +123,8 @@ public class GeneralColorsPage implements ColorSettingsPage, InspectionColorSett
new ColorDescriptor(OptionsBundle.message("options.general.color.descriptor.selection.foreground"), EditorColors.SELECTION_FOREGROUND_COLOR, ColorDescriptor.Kind.FOREGROUND),
new ColorDescriptor(OptionsBundle.message("options.general.color.descriptor.scrollbar.thumb.while.scrolling"), EditorColors.SCROLLBAR_THUMB_WHILE_SCROLLING_COLOR, ColorDescriptor.Kind.BACKGROUND_WITH_TRANSPARENCY),
new ColorDescriptor(OptionsBundle.message("options.general.color.descriptor.scrollbar.thumb"), EditorColors.SCROLLBAR_THUMB_COLOR, ColorDescriptor.Kind.BACKGROUND_WITH_TRANSPARENCY),
new ColorDescriptor(OptionsBundle.message("options.general.color.descriptor.tabs.selected.underline"), EditorColors.TAB_UNDERLINE, ColorDescriptor.Kind.BACKGROUND),
new ColorDescriptor(OptionsBundle.message("options.general.color.descriptor.tabs.selected.underline.inactive"), EditorColors.TAB_UNDERLINE_INACTIVE, ColorDescriptor.Kind.BACKGROUND),
new ColorDescriptor(OptionsBundle.message("options.general.color.descriptor.caret"), EditorColors.CARET_COLOR, ColorDescriptor.Kind.FOREGROUND),
new ColorDescriptor(OptionsBundle.message("options.general.color.descriptor.caret.row"), EditorColors.CARET_ROW_COLOR, ColorDescriptor.Kind.BACKGROUND),
new ColorDescriptor(OptionsBundle.message("options.general.color.descriptor.right.margin"), EditorColors.RIGHT_MARGIN_COLOR, ColorDescriptor.Kind.FOREGROUND),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.ui.tabs.impl.themes

import com.intellij.openapi.editor.colors.EditorColors
import com.intellij.openapi.editor.colors.EditorColorsManager
import com.intellij.openapi.editor.colors.EditorColorsScheme
import com.intellij.util.ui.JBUI
import java.awt.Color

Expand Down Expand Up @@ -37,29 +40,39 @@ open class DefaultTabTheme : TabTheme {
}

class EditorTabTheme : TabTheme {
val globalScheme: EditorColorsScheme
get() = EditorColorsManager.getInstance().globalScheme

override val background: Color?
get() = JBUI.CurrentTheme.EditorTabs.background()
override val borderColor: Color
get() = JBUI.CurrentTheme.EditorTabs.borderColor()

override val underlineColor: Color
get() = JBUI.CurrentTheme.EditorTabs.underlineColor()
get() = globalScheme.getColor(EditorColors.TAB_UNDERLINE) ?: JBUI.CurrentTheme.EditorTabs.underlineColor()

override val inactiveUnderlineColor: Color
get() = JBUI.CurrentTheme.EditorTabs.inactiveUnderlineColor()
get() = globalScheme.getColor(EditorColors.TAB_UNDERLINE_INACTIVE) ?: JBUI.CurrentTheme.EditorTabs.inactiveUnderlineColor()

override val hoverBackground: Color
get() = JBUI.CurrentTheme.EditorTabs.hoverBackground()
override val underlinedTabBackground: Color?
get() = JBUI.CurrentTheme.EditorTabs.underlinedTabBackground()
get() = globalScheme.getAttributes(EditorColors.TAB_SELECTED).backgroundColor?: JBUI.CurrentTheme.EditorTabs.underlinedTabBackground()

override val underlinedTabForeground: Color
get() = JBUI.CurrentTheme.EditorTabs.underlinedTabForeground()
get() = globalScheme.getAttributes(EditorColors.TAB_SELECTED).foregroundColor?: JBUI.CurrentTheme.EditorTabs.underlinedTabForeground()

override val underlineHeight: Int
get() = JBUI.CurrentTheme.EditorTabs.underlineHeight()

override val hoverInactiveBackground: Color?
get() = hoverBackground

override val underlinedTabInactiveBackground: Color?
get() = underlinedTabBackground
get() = globalScheme.getAttributes(EditorColors.TAB_SELECTED_INACTIVE).backgroundColor?: underlinedTabBackground

override val underlinedTabInactiveForeground: Color
get() = underlinedTabForeground
get() = globalScheme.getAttributes(EditorColors.TAB_SELECTED_INACTIVE).foregroundColor?: underlinedTabForeground

val inactiveColoredFileBackground: Color?
get() = JBUI.CurrentTheme.EditorTabs.inactiveColoredFileBackground()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,10 @@ options.general.color.descriptor.selection.background=Editor//Selection backgrou
options.general.color.descriptor.selection.foreground=Editor//Selection foreground
options.general.color.descriptor.scrollbar.thumb.while.scrolling=Editor//Vertical Scrollbar//Thumb while scrolling
options.general.color.descriptor.scrollbar.thumb=Editor//Vertical Scrollbar//Thumb
options.general.color.descriptor.tabs.selected.tab=Editor//Tabs//Selected Tab
options.general.color.descriptor.tabs.selected.tab.inactive=Editor//Tabs//Selected Tab inactive
options.general.color.descriptor.tabs.selected.underline=Editor//Tabs//Underline
options.general.color.descriptor.tabs.selected.underline.inactive=Editor//Tabs//Underline inactive
options.general.color.descriptor.caret=Editor//Caret
options.general.color.descriptor.caret.row=Editor//Caret row
options.general.color.descriptor.right.margin=Editor//Guides//Hard wrap guide
Expand Down

0 comments on commit bf26eb8

Please sign in to comment.