From 69ef79f78b1a84969720c76fc4e803713460b796 Mon Sep 17 00:00:00 2001 From: Konstantin Bulenkov Date: Mon, 19 Dec 2016 21:38:05 +0100 Subject: [PATCH] SliderUI: add focus insets and move all colors to darcula.properties --- src/com/bulenkov/darcula/darcula.properties | 6 ++++++ src/com/bulenkov/darcula/ui/DarculaSliderUI.java | 15 ++++----------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/com/bulenkov/darcula/darcula.properties b/src/com/bulenkov/darcula/darcula.properties index ac4c0e0..7852aa1 100755 --- a/src/com/bulenkov/darcula/darcula.properties +++ b/src/com/bulenkov/darcula/darcula.properties @@ -148,6 +148,12 @@ Button.darcula.disabledText.shadow=00000000 SliderUI=com.bulenkov.darcula.ui.DarculaSliderUI Slider.tickColor=888888 Slider.focus=888888 +Slider.disabledTickColor=555555 +Slider.selectedTrackColor=888888 +Slider.trackBackground=2b2b2b +Slider.thumbBorderColor=707070 +Slider.thumbBorderColorDisabled=444444 +Slider.focusInsets=2,2,2,2 ToggleButtonUI=com.bulenkov.darcula.ui.DarculaToggleButtonUI diff --git a/src/com/bulenkov/darcula/ui/DarculaSliderUI.java b/src/com/bulenkov/darcula/ui/DarculaSliderUI.java index 222881c..61f5004 100644 --- a/src/com/bulenkov/darcula/ui/DarculaSliderUI.java +++ b/src/com/bulenkov/darcula/ui/DarculaSliderUI.java @@ -16,7 +16,6 @@ package com.bulenkov.darcula.ui; -import com.bulenkov.iconloader.util.ColorUtil; import com.bulenkov.iconloader.util.GraphicsConfig; import com.bulenkov.iconloader.util.GraphicsUtil; import com.intellij.util.ui.JBDimension; @@ -98,22 +97,17 @@ public class DarculaSliderUI extends BasicSliderUI { @NotNull protected Color getTrackBackground() { - return ColorUtil.fromHex("2b2b2b"); + return UIManager.getColor("Slider.trackBackground"); } @NotNull protected Color getSelectedTrackColor() { - return ColorUtil.fromHex("888888"); + return UIManager.getColor("Slider.selectedTrackColor"); } @NotNull protected Color getDisabledTickColor() { - return ColorUtil.fromHex("555555"); - } - - @Override - public void paintTicks(Graphics g) { - super.paintTicks(g); + return UIManager.getColor("Slider.disabledTickColor"); } @Override @@ -179,7 +173,6 @@ public class DarculaSliderUI extends BasicSliderUI { g.setColor(slider.getBackground().darker()); } - if (isPlainThumb()) { double r = slider.getOrientation() == JSlider.HORIZONTAL ? h : w; final Ellipse2D.Double thumb = new Ellipse2D.Double(0, 0, r, r); @@ -259,7 +252,7 @@ public class DarculaSliderUI extends BasicSliderUI { @NotNull protected Color getThumbBorderColor() { - return slider.isEnabled() ? ColorUtil.fromHex("707070") : ColorUtil.fromHex("444444"); + return slider.isEnabled() ? UIManager.getColor("Slider.thumbBorderColor") : UIManager.getColor("Slider.thumbBorderColorDisabled"); } protected boolean isPlainThumb() {