mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
custom colors for Darcula and IntelliJ
This commit is contained in:
+19
-8
@@ -18,6 +18,7 @@ package com.intellij.ide.ui.laf.darcula.ui;
|
||||
import com.intellij.ide.ui.laf.darcula.DarculaUIUtil;
|
||||
import com.intellij.openapi.ui.GraphicsConfig;
|
||||
import com.intellij.ui.Gray;
|
||||
import com.intellij.ui.JBColor;
|
||||
import com.intellij.util.ui.GraphicsUtil;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
|
||||
@@ -26,6 +27,8 @@ import javax.swing.border.Border;
|
||||
import javax.swing.plaf.InsetsUIResource;
|
||||
import javax.swing.plaf.UIResource;
|
||||
import java.awt.*;
|
||||
import java.awt.geom.Area;
|
||||
import java.awt.geom.RoundRectangle2D;
|
||||
|
||||
/**
|
||||
* @author Konstantin Bulenkov
|
||||
@@ -36,9 +39,9 @@ public class DarculaSpinnerBorder implements Border, UIResource {
|
||||
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
|
||||
final JSpinner spinner = (JSpinner)c;
|
||||
final JFormattedTextField editor = UIUtil.findComponentOfType(spinner, JFormattedTextField.class);
|
||||
final int x1 = x + 3;
|
||||
final int x1 = x + 1;
|
||||
final int y1 = y + 3;
|
||||
final int width1 = width - 8;
|
||||
final int width1 = width - 2;
|
||||
final int height1 = height - 6;
|
||||
final boolean focused = c.isEnabled() && c.isVisible() && editor != null && editor.hasFocus();
|
||||
final GraphicsConfig config = GraphicsUtil.setupAAPainting(g);
|
||||
@@ -50,12 +53,20 @@ public class DarculaSpinnerBorder implements Border, UIResource {
|
||||
|
||||
g.setColor(UIUtil.getTextFieldBackground());
|
||||
g.fillRoundRect(x1, y1, width1, height1, 5, 5);
|
||||
g.setColor(UIUtil.getPanelBackground());
|
||||
g.setColor(UIManager.getColor(spinner.isEnabled() ? "Spinner.darcula.enabledButtonColor" : "Spinner.darcula.disabledButtonColor"));
|
||||
if (editor != null) {
|
||||
final int off = editor.getBounds().x + editor.getWidth() + ((JSpinner)c).getInsets().left + 1;
|
||||
g.fillRect(off, y1, 17, height1);
|
||||
g.setColor(Gray._100);
|
||||
g.drawLine(off, y1, off, height1+2);
|
||||
final Area rect = new Area(new RoundRectangle2D.Double(x1, y1, width1, height1, 5, 5));
|
||||
final Area blueRect = new Area(new Rectangle(off, y1, 22, height1));
|
||||
rect.intersect(blueRect);
|
||||
|
||||
if (UIUtil.isUnderDarcula()) {
|
||||
g.fillRect(off, y1, 22, height1);
|
||||
g.setColor(Gray._100);
|
||||
g.drawLine(off, y1, off, height1+2);
|
||||
} else {
|
||||
((Graphics2D)g).fill(rect);
|
||||
}
|
||||
}
|
||||
|
||||
if (!c.isEnabled()) {
|
||||
@@ -63,9 +74,9 @@ public class DarculaSpinnerBorder implements Border, UIResource {
|
||||
}
|
||||
|
||||
if (focused) {
|
||||
DarculaUIUtil.paintFocusRing(g, x1, y1, width1, height1);
|
||||
DarculaUIUtil.paintFocusRing(g, x1+2, y1, width1-4, height1);
|
||||
} else {
|
||||
g.setColor(Gray._100);
|
||||
g.setColor(new JBColor(Gray._149,Gray._100));
|
||||
g.drawRoundRect(x1, y1, width1, height1, 5, 5);
|
||||
}
|
||||
config.restore();
|
||||
|
||||
Reference in New Issue
Block a user