本文整理汇总了Java中com.intellij.ui.ColorUtil.shift方法的典型用法代码示例。如果您正苦于以下问题:Java ColorUtil.shift方法的具体用法?Java ColorUtil.shift怎么用?Java ColorUtil.shift使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.ui.ColorUtil
的用法示例。
在下文中一共展示了ColorUtil.shift方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: computeBgColors
import com.intellij.ui.ColorUtil; //导入方法依赖的package包/类
@Nullable
private static Map<String, Color> computeBgColors(FileAnnotation fileAnnotation) {
final Map<String, Color> bgColors = new HashMap<String, Color>();
final Map<String, Color> revNumbers = new HashMap<String, Color>();
final int length = BG_COLORS.length;
final List<VcsFileRevision> fileRevisionList = fileAnnotation.getRevisions();
final boolean darcula = UIUtil.isUnderDarcula();
if (fileRevisionList != null) {
for (VcsFileRevision revision : fileRevisionList) {
final String author = revision.getAuthor();
final String revNumber = revision.getRevisionNumber().asString();
if (author != null && !bgColors.containsKey(author)) {
final int size = bgColors.size();
Color color = BG_COLORS[size < length ? size : size % length];
if (darcula) {
color = ColorUtil.shift(color, 0.3);
}
bgColors.put(author, color);
}
if (revNumber != null && !revNumbers.containsKey(revNumber)) {
revNumbers.put(revNumber, bgColors.get(author));
}
}
}
return bgColors.size() < 2 ? null : revNumbers;
}
示例2: produce
import com.intellij.ui.ColorUtil; //导入方法依赖的package包/类
@NotNull
@Override
public Color produce() {
Container parent = myComponent.getParent();
if (isBackground && parent instanceof JScrollPane && Registry.is("ide.scroll.background.auto")) {
Color background = JBScrollPane.getViewBackground((JScrollPane)parent);
if (background != null) {
if (!background.equals(myOriginal)) {
myModified = ColorUtil.shift(background, ColorUtil.isDark(background) ? 1.05 : 0.96);
myOriginal = background;
}
return myModified;
}
}
return isDark(myComponent) ? myDarkColor : myBrightColor;
}
示例3: paint
import com.intellij.ui.ColorUtil; //导入方法依赖的package包/类
@Override
public void paint(Graphics g2, JComponent c) {
final Graphics2D g = (Graphics2D)g2;
final GraphicsConfig config = new GraphicsConfig(g);
final Color bg = c.getBackground();
g.setPaint(new GradientPaint(0, 0, ColorUtil.shift(bg, 1.4), 0, c.getHeight(), ColorUtil.shift(bg, 0.9)));
final int h = c.getHeight();
final int w = c.getWidth();
g.fillRect(0,0, w, h);
g.setPaint(ColorUtil.shift(bg, 0.75));
g.drawLine(0, h-1, w, h-1);
g.drawLine(w-1, 0, w-1, h-1);
final Enumeration<TableColumn> columns = ((JTableHeader)c).getColumnModel().getColumns();
final Color lineColor = ColorUtil.shift(bg, 0.7);
final Color shadow = Gray._255.withAlpha(30);
int offset = 0;
while (columns.hasMoreElements()) {
final TableColumn column = columns.nextElement();
if (columns.hasMoreElements() && column.getWidth() > 0) {
offset += column.getWidth();
g.setColor(lineColor);
g.drawLine(offset-1, 1, offset-1, h-3);
g.setColor(shadow);
g.drawLine(offset, 1, offset, h-3);
}
}
config.restore();
super.paint(g, c);
}
示例4: drawSpot
import com.intellij.ui.ColorUtil; //导入方法依赖的package包/类
private void drawSpot(Graphics g,
int width,
boolean thinErrorStripeMark,
int yStart,
int yEnd,
Color color,
boolean drawTopDecoration,
boolean drawBottomDecoration) {
int x = isMirrored() ? 3 : 5;
int paintWidth = width;
if (thinErrorStripeMark) {
paintWidth /= 2;
paintWidth += 1;
x = isMirrored() ? width + 2 : 0;
}
if (color == null) return;
g.setColor(color);
g.fillRect(x + 1, yStart, paintWidth - 2, yEnd - yStart + 1);
Color brighter = color.brighter();
g.setColor(brighter);
//left decoration
UIUtil.drawLine(g, x, yStart, x, yEnd/* - 1*/);
if (drawTopDecoration) {
//top decoration
UIUtil.drawLine(g, x + 1, yStart, x + paintWidth - 2, yStart);
}
Color darker = ColorUtil.shift(color, 0.75);
g.setColor(darker);
if (drawBottomDecoration) {
// bottom decoration
UIUtil.drawLine(g, x + 1, yEnd/* - 1*/, x + paintWidth - 2, yEnd/* - 1*/); // large bottom to let overwrite by hl below
}
//right decoration
UIUtil.drawLine(g, x + paintWidth - 2, yStart, x + paintWidth - 2, yEnd/* - 1*/);
}
示例5: paint
import com.intellij.ui.ColorUtil; //导入方法依赖的package包/类
@Override
public void paint(Graphics g2, JComponent c) {
final Graphics2D g = (Graphics2D)g2;
final GraphicsConfig config = new GraphicsConfig(g);
final Color bg = c.getBackground();
g.setPaint(UIUtil.getGradientPaint(0, 0, ColorUtil.shift(bg, 1.4), 0, c.getHeight(), ColorUtil.shift(bg, 0.9)));
final int h = c.getHeight();
final int w = c.getWidth();
g.fillRect(0,0, w, h);
g.setPaint(ColorUtil.shift(bg, 0.75));
g.drawLine(0, h-1, w, h-1);
g.drawLine(w-1, 0, w-1, h-1);
final Enumeration<TableColumn> columns = ((JTableHeader)c).getColumnModel().getColumns();
final Color lineColor = ColorUtil.shift(bg, 0.7);
final Color shadow = Gray._255.withAlpha(30);
int offset = 0;
while (columns.hasMoreElements()) {
final TableColumn column = columns.nextElement();
if (columns.hasMoreElements() && column.getWidth() > 0) {
offset += column.getWidth();
g.setColor(lineColor);
g.drawLine(offset-1, 1, offset-1, h-3);
g.setColor(shadow);
g.drawLine(offset, 1, offset, h-3);
}
}
config.restore();
super.paint(g, c);
}
示例6: createLineMarkerRenderer
import com.intellij.ui.ColorUtil; //导入方法依赖的package包/类
@Nullable
public static LineMarkerRenderer createLineMarkerRenderer(boolean matched) {
EditorColorsScheme scheme = EditorColorsManager.getInstance().getGlobalScheme();
final TextAttributes attributes =
matched ? scheme.getAttributes(CodeInsightColors.MATCHED_BRACE_ATTRIBUTES)
: scheme.getAttributes(CodeInsightColors.UNMATCHED_BRACE_ATTRIBUTES);
Color color = attributes.getBackgroundColor();
if (color == null) return null;
color = ColorUtil.isDark(scheme.getDefaultBackground()) ? ColorUtil.shift(color, 1.5d) : color.darker();
return new MyLineMarkerRenderer(color);
}
示例7: getHighlightColor
import com.intellij.ui.ColorUtil; //导入方法依赖的package包/类
public Color getHighlightColor() {
return UIUtil.isUnderDarcula() ? ColorUtil.shift(UIUtil.getTreeBackground(), 1.1) : UIUtil.getTreeBackground().brighter();
}
示例8: highlightBraces
import com.intellij.ui.ColorUtil; //导入方法依赖的package包/类
private void highlightBraces(@Nullable TextRange lBrace, @Nullable TextRange rBrace, boolean matched, boolean scopeHighlighting, @NotNull FileType fileType) {
if (!matched && fileType == FileTypes.PLAIN_TEXT) {
return;
}
EditorColorsScheme scheme = myEditor.getColorsScheme();
final TextAttributes attributes =
matched ? scheme.getAttributes(CodeInsightColors.MATCHED_BRACE_ATTRIBUTES)
: scheme.getAttributes(CodeInsightColors.UNMATCHED_BRACE_ATTRIBUTES);
if (rBrace != null && !scopeHighlighting) {
highlightBrace(rBrace, matched);
}
if (lBrace != null && !scopeHighlighting) {
highlightBrace(lBrace, matched);
}
FileEditorManager fileEditorManager = FileEditorManager.getInstance(myProject); // null in default project
if (fileEditorManager == null || !myEditor.equals(fileEditorManager.getSelectedTextEditor())) {
return;
}
if (lBrace != null && rBrace !=null) {
final int startLine = myEditor.offsetToLogicalPosition(lBrace.getStartOffset()).line;
final int endLine = myEditor.offsetToLogicalPosition(rBrace.getEndOffset()).line;
if (endLine - startLine > 0) {
final Runnable runnable = new Runnable() {
@Override
public void run() {
if (myProject.isDisposed() || myEditor.isDisposed()) return;
Color color = attributes.getBackgroundColor();
if (color == null) return;
color = ColorUtil.isDark(EditorColorsManager.getInstance().getGlobalScheme().getDefaultBackground()) ? ColorUtil.shift(color, 1.5d) : color.darker();
lineMarkFragment(startLine, endLine, color);
}
};
if (!scopeHighlighting) {
myAlarm.addRequest(runnable, 300);
}
else {
runnable.run();
}
}
else {
if (!myCodeInsightSettings.HIGHLIGHT_SCOPE) {
removeLineMarkers();
}
}
if (!scopeHighlighting) {
showScopeHint(lBrace.getStartOffset(), lBrace.getEndOffset());
}
}
else {
if (!myCodeInsightSettings.HIGHLIGHT_SCOPE) {
removeLineMarkers();
}
}
}
示例9: highlightBraces
import com.intellij.ui.ColorUtil; //导入方法依赖的package包/类
private void highlightBraces(final TextRange lBrace, TextRange rBrace, boolean matched, boolean scopeHighlighting, FileType fileType) {
if (!matched && fileType == FileTypes.PLAIN_TEXT) {
return;
}
EditorColorsScheme scheme = EditorColorsManager.getInstance().getGlobalScheme();
final TextAttributes attributes =
matched ? scheme.getAttributes(CodeInsightColors.MATCHED_BRACE_ATTRIBUTES)
: scheme.getAttributes(CodeInsightColors.UNMATCHED_BRACE_ATTRIBUTES);
if (rBrace != null && !scopeHighlighting) {
highlightBrace(rBrace, matched);
}
if (lBrace != null && !scopeHighlighting) {
highlightBrace(lBrace, matched);
}
if (!myEditor.equals(FileEditorManager.getInstance(myProject).getSelectedTextEditor())) {
return;
}
if (lBrace != null && rBrace !=null) {
final int startLine = myEditor.offsetToLogicalPosition(lBrace.getStartOffset()).line;
final int endLine = myEditor.offsetToLogicalPosition(rBrace.getEndOffset()).line;
if (endLine - startLine > 0) {
final Runnable runnable = new Runnable() {
@Override
public void run() {
if (myProject.isDisposed() || myEditor.isDisposed()) return;
Color color = attributes.getBackgroundColor();
if (color == null) return;
if (UIUtil.isUnderDarcula()) {
color = ColorUtil.shift(color, 1.1d);
} else {
color = color.darker();
}
lineMarkFragment(startLine, endLine, color);
}
};
if (!scopeHighlighting) {
myAlarm.addRequest(runnable, 300);
}
else {
runnable.run();
}
}
else {
if (!myCodeInsightSettings.HIGHLIGHT_SCOPE) {
removeLineMarkers();
}
}
if (!scopeHighlighting) {
showScopeHint(lBrace.getStartOffset(), lBrace.getEndOffset());
}
}
else {
if (!myCodeInsightSettings.HIGHLIGHT_SCOPE) {
removeLineMarkers();
}
}
}
示例10: paintSelectionAndBorder
import com.intellij.ui.ColorUtil; //导入方法依赖的package包/类
@Override
protected void paintSelectionAndBorder(Graphics2D g2d) {
if (getSelectedInfo() == null) return;
final boolean dark = UIUtil.isUnderDarcula();
final Color col = dark ? ColorUtil.shift(UIUtil.getListBackground(), 1.6) : Gray._255;
final Color panelBg = dark ? ColorUtil.shift(UIUtil.getPanelBackground(), 1.3) : UIUtil.getPanelBackground();
TabLabel label = getSelectedLabel();
Rectangle r = label.getBounds();
r = new Rectangle(r.x, r.y + 3, r.width, r.height - 3);
ShapeInfo selectedShape = _computeSelectedLabelShape(r);
Insets insets = getTabsBorder().getEffectiveBorder();
Insets i = selectedShape.path.transformInsets(insets);
int _x = r.x;
int _y = r.y;
int _height = r.height;
if (!isHideTabs()) {
g2d.setPaint(UIUtil.getGradientPaint(_x, _y, col, _x, _y + _height - 3, panelBg));
g2d.fill(selectedShape.fillPath.getShape());
g2d.setColor(ColorUtil.toAlpha(col, 180));
g2d.draw(selectedShape.fillPath.getShape());
// fix right side due to swing stupidity (fill & draw will occupy different shapes)
g2d.draw(selectedShape.labelPath
.transformLine(selectedShape.labelPath.getMaxX() - selectedShape.labelPath.deltaX(1), selectedShape.labelPath.getY() +
selectedShape.labelPath.deltaY(1),
selectedShape.labelPath.getMaxX() - selectedShape.labelPath.deltaX(1), selectedShape.labelPath.getMaxY() -
selectedShape.labelPath.deltaY(4)));
}
if (UIUtil.isUnderDarcula()) return;
g2d.setColor(panelBg);
g2d.fillRect(2, selectedShape.labelPath.getMaxY() - 2, selectedShape.path.getMaxX() - 2, 3);
g2d.drawLine(1, selectedShape.labelPath.getMaxY(), 1, getHeight() - 1);
g2d.drawLine(selectedShape.path.getMaxX() - 1, selectedShape.labelPath.getMaxY() - 4,
selectedShape.path.getMaxX() - 1, getHeight() - 1);
if (isHideTabs()) return;
g2d.setColor(Gray._0.withAlpha(50));
g2d.drawLine(1, selectedShape.labelPath.getMaxY(), 1, getHeight() - 1);
g2d.drawLine(selectedShape.path.getMaxX() - 1, selectedShape.labelPath.getMaxY() - 4,
selectedShape.path.getMaxX() - 1, getHeight() - 1);
}