button border for darcula

This commit is contained in:
Konstantin Bulenkov
2012-09-05 19:20:31 +04:00
parent a84f0481c5
commit 7003a67e3e
2 changed files with 88 additions and 20 deletions
@@ -0,0 +1,64 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.ide.ui.laf.borders;
import com.intellij.openapi.ui.GraphicsConfig;
import com.intellij.ui.Gray;
import com.intellij.util.ui.JBInsets;
import com.intellij.util.ui.MacUIUtil;
import javax.swing.border.Border;
import javax.swing.plaf.UIResource;
import java.awt.*;
/**
* @author Konstantin Bulenkov
*/
public class DarculaButtonPainter implements Border, UIResource {
private static final JBInsets myInsets = new JBInsets(6, 12, 6, 12);
private static final int offset = 4;
@Override
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
final Graphics2D g2d = (Graphics2D)g;
final int yOff = myInsets.height() / 4;
if (c.hasFocus()) {
MacUIUtil.paintFocusRing(g2d, new Color(89, 157, 231), new Rectangle(offset, yOff, width-2*offset, height - 2*yOff));
} else {
final GraphicsConfig config = new GraphicsConfig(g);
g2d.setPaint(new GradientPaint(width / 2, y + yOff + 1, Gray._120, width / 2, height - 2*yOff, Gray._105));
g.drawRoundRect(x + offset, y + yOff + 1, width - 2 * offset, height - 2*yOff, 2, 2);
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2d.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE);
((Graphics2D)g).setPaint(Gray._30);
g.drawRoundRect(x + offset, y + yOff, width - 2 * offset, height - 2*yOff, 4, 4);
config.restore();
}
}
@Override
public Insets getBorderInsets(Component c) {
return myInsets;
}
@Override
public boolean isBorderOpaque() {
return false;
}
}
@@ -3,53 +3,53 @@ MenuItem.maxGutterIconWidth=18
MenuItem.acceleratorDelimiter=-
#Trees
Tree.background=444444
Tree.background=535353
Tree.foreground=cccccc
Tree.textForeground=cccccc
Tree.textBackground=444444
Tree.textBackground=535353
#Tree.selectionBackground=BEBEBE
#Tree.selectionForeground=444444
#Tree.selectionForeground=535353
#Lists
List.background=444444
List.background=535353
List.foreground=cccccc
#Tables
Table.background=444444
Table.background=535353
Table.foreground=cccccc
control=444444
Panel.background=404040
control=535353
Panel.background=535353
Panel.foreground=cccccc
Menu.selectionBackground=bebebe
MenuBar.background=444444
MenuBar.disabledBackground=444444
MenuBar.shadow=444444
Menu.background=444444
MenuItem.background=444444
MenuBar.background=535353
MenuBar.disabledBackground=535353
MenuBar.shadow=535353
Menu.background=535353
MenuItem.background=535353
Menu.foreground=cccccc
MenuItem.foreground=cccccc
TabbedPane.tabInsets=0,4,0,4
ToggleButton.foreground=cccccc
Separator.background=444444
Separator.background=535353
Separator.foreground=888888
Label.background=404040
Label.background=535353
Label.foreground=cccccc
Focus.color=ff0000
TextField.background=444444
TextField.background=535353
TextField.foreground=cccccc
TextField.caretForeground=cccccc
TextArea.background=444444
TextArea.background=535353
TextArea.foreground=cccccc
TextArea.caretForeground=cccccc
TextPane.background=444444
TextPane.background=535353
TextPane.foreground=cccccc
TextPane.caretForeground=cccccc
CheckBox.background=444444
CheckBox.background=535353
CheckBox.foreground=cccccc
RadioButton.foreground=cccccc
@@ -58,6 +58,10 @@ StatusBar.top2Color=2c2c2c
StatusBar.bottomColor=2c2c2c
Button.foreground=cccccc
Button.background=535353
Button.border=com.intellij.ide.ui.laf.borders.DarculaButtonPainter
MenuItem.acceleratorForeground=cccccc
PopupMenu.background=444444
PopupMenu.translucentBackground=444444
PopupMenu.background=535353
PopupMenu.translucentBackground=535353