IDEA-214964: make UIUtil.getTreeBackground() (and others) to be named color

GitOrigin-RevId: 6963abb06c435191697d5ee1b16182499585cae6
This commit is contained in:
Sergey Malenkov
2019-07-02 06:52:16 +03:00
committed by intellij-monorepo-bot
parent 1432a7e3f5
commit 15199828e7
4 changed files with 19 additions and 11 deletions
@@ -143,7 +143,7 @@ public abstract class SlicePanel extends JPanel implements TypeSafeDataProvider,
add(createToolbar().getComponent(), BorderLayout.WEST);
myTree.getParent().setBackground(UIManager.getColor("Tree.background"));
myTree.getParent().setBackground(UIUtil.getTreeBackground());
revalidate();
}
@@ -518,7 +518,7 @@ public class ToolWindowManagerImpl extends ToolWindowManagerEx implements Persis
private static JLabel createInitializingLabel() {
JLabel label = new JLabel("Initializing...", SwingConstants.CENTER);
label.setOpaque(true);
final Color treeBg = UIManager.getColor("Tree.background");
final Color treeBg = UIUtil.getTreeBackground();
label.setBackground(ColorUtil.toAlpha(treeBg, 180));
final Color treeFg = UIUtil.getTreeForeground();
label.setForeground(ColorUtil.toAlpha(treeFg, 180));
@@ -1695,7 +1695,7 @@ public class BalloonImpl implements Balloon, IdeTooltip.Ui, ScreenAreaConsumer {
Wrapper contentWrapper = new Wrapper(content);
if (myTitle != null) {
myTitleLabel = new JLabel(myTitle, SwingConstants.CENTER);
myTitleLabel.setForeground(UIManager.getColor("List.background"));
myTitleLabel.setForeground(UIUtil.getListBackground());
myTitleLabel.setBorder(JBUI.Borders.empty(0, 4));
myContent.add(myTitleLabel, BorderLayout.NORTH);
contentWrapper.setBorder(JBUI.Borders.empty(1));
@@ -3649,6 +3649,18 @@ public final class UIUtil extends StartupUiUtil {
}
private static final Color BACKGROUND = new JBColor(0xFFFFFF, 0x3C3F41);
private static final Color LIST_BACKGROUND = JBColor.namedColor("List.background", BACKGROUND);
private static final Color TREE_BACKGROUND = JBColor.namedColor("Tree.background", BACKGROUND);
private static final Color TABLE_BACKGROUND = JBColor.namedColor("Table.background", BACKGROUND);
private static final class FocusedSelection {
private static final Color BACKGROUND = new JBColor(0x3875D6, 0x2F65CA);
private static final Color LIST_BACKGROUND = JBColor.namedColor("List.selectionBackground", BACKGROUND);
private static final Color TREE_BACKGROUND = JBColor.namedColor("Tree.selectionBackground", BACKGROUND);
private static final Color TABLE_BACKGROUND = JBColor.namedColor("Table.selectionBackground", BACKGROUND);
}
private static final class UnfocusedSelection {
private static final Color BACKGROUND = new JBColor(0xD4D4D4, 0x0D293E);
private static final Color LIST_BACKGROUND = JBColor.namedColor("List.selectionInactiveBackground", BACKGROUND);
@@ -3667,8 +3679,6 @@ public final class UIUtil extends StartupUiUtil {
// background
private static final Color LIST_BACKGROUND = JBColor.namedColor("List.background", new JBColor(0xffffff, 0x3c3f41));
@NotNull
public static Color getListBackground() {
return LIST_BACKGROUND;
@@ -3773,13 +3783,12 @@ public final class UIUtil extends StartupUiUtil {
@NotNull
public static Color getTreeBackground() {
return UIManager.getColor("Tree.background");
return TREE_BACKGROUND;
}
@NotNull
public static Color getTreeSelectionBackground(boolean focused) {
if (!focused) return UnfocusedSelection.TREE_BACKGROUND;
return UIManager.getColor("Tree.selectionBackground");
return focused ? FocusedSelection.TREE_BACKGROUND : UnfocusedSelection.TREE_BACKGROUND;
}
@NotNull
@@ -3834,13 +3843,12 @@ public final class UIUtil extends StartupUiUtil {
@NotNull
public static Color getTableBackground() {
return UIManager.getColor("Table.background");
return TABLE_BACKGROUND;
}
@NotNull
public static Color getTableSelectionBackground(boolean focused) {
if (!focused) return UnfocusedSelection.TABLE_BACKGROUND;
return UIManager.getColor("Table.selectionBackground");
return focused ? FocusedSelection.TABLE_BACKGROUND : UnfocusedSelection.TABLE_BACKGROUND;
}
@NotNull