Java Code Examples for com.intellij.ui.ColorUtil#mix()
The following examples show how to use
com.intellij.ui.ColorUtil#mix() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LabelPainter.java From consulo with Apache License 2.0 | 6 votes |
@Nullable private static Color calculateGreyBackground(@Nonnull List<RefGroup> refGroups, @Nonnull Color background, boolean isSelected, boolean isCompact) { if (isSelected) return null; if (!isCompact) return ColorUtil.mix(background, BACKGROUND, BALANCE); boolean paintGreyBackground; for (RefGroup group : refGroups) { if (group.isExpanded()) { paintGreyBackground = ContainerUtil.find(group.getRefs(), ref -> !ref.getName().isEmpty()) != null; } else { paintGreyBackground = !group.getName().isEmpty(); } if (paintGreyBackground) return ColorUtil.mix(background, BACKGROUND, BALANCE); } return null; }
Example 2
Source File: ApplyPatchChange.java From consulo with Apache License 2.0 | 6 votes |
private void createStatusHighlighter() { int line1 = myPatchDeletionRange.start; int line2 = myPatchInsertionRange.end; Color color = getStatusColor(); if (isResolved()) { color = ColorUtil.mix(color, myViewer.getPatchEditor().getGutterComponentEx().getBackground(), 0.6f); } String tooltip = getStatusText(); EditorEx patchEditor = myViewer.getPatchEditor(); Document document = patchEditor.getDocument(); MarkupModelEx markupModel = patchEditor.getMarkupModel(); TextRange textRange = DiffUtil.getLinesRange(document, line1, line2); RangeHighlighter highlighter = markupModel.addRangeHighlighter(textRange.getStartOffset(), textRange.getEndOffset(), HighlighterLayer.LAST, null, HighlighterTargetArea.LINES_IN_RANGE); PairConsumer<Editor, MouseEvent> clickHandler = getResultRange() != null ? (e, event) -> myViewer.scrollToChange(this, Side.RIGHT, false) : null; highlighter.setLineMarkerRenderer(LineStatusMarkerRenderer.createRenderer(line1, line2, color, tooltip, clickHandler)); myHighlighters.add(highlighter); }
Example 3
Source File: DiffLineSeparatorRenderer.java From consulo with Apache License 2.0 | 5 votes |
@Nullable private static Color getTopBorderColor(int i, int lineHeight, @Nonnull EditorColorsScheme scheme) { int border = Math.max(lineHeight / 4, 1); double ratio = (double)i / border; if (ratio > 1) return null; Color top = scheme.getColor(TOP_BORDER); if (top == null) return null; Color background = getBackgroundColor(scheme); return ColorUtil.mix(top, background, ratio); }
Example 4
Source File: DiffLineSeparatorRenderer.java From consulo with Apache License 2.0 | 5 votes |
@Nullable private static Color getBottomBorderColor(int i, int lineHeight, @Nonnull EditorColorsScheme scheme) { int height = getHeight(lineHeight); int border = Math.max(lineHeight / 12, 1); int index = (height - i - 1); double ratio = (double)index / border; if (ratio > 1) return null; Color bottom = scheme.getColor(BOTTOM_BORDER); if (bottom == null) return null; Color background = getBackgroundColor(scheme); return ColorUtil.mix(bottom, background, ratio); }
Example 5
Source File: VcsLogColorManagerImpl.java From consulo with Apache License 2.0 | 4 votes |
@Nonnull public static JBColor getBackgroundColor(@Nonnull final Color baseRootColor) { return new JBColor(() -> ColorUtil.mix(baseRootColor, UIUtil.getTableBackground(), 0.75)); }
Example 6
Source File: AbstractCustomizeWizardStep.java From consulo with Apache License 2.0 | 4 votes |
@Nonnull protected static Color getSelectionBackground() { return ColorUtil.mix(UIUtil.getListSelectionBackground(), UIUtil.getLabelBackground(), UIUtil.isUnderDarcula() ? .5 : .75); }
Example 7
Source File: EventLogConsole.java From consulo with Apache License 2.0 | 4 votes |
public void showNotification(@Nonnull final List<String> ids) { clearNMore(); myNMoreHighlighters = new ArrayList<RangeHighlighter>(); EditorEx editor = (EditorEx)getConsoleEditor(); List<RangeHighlighterEx> highlighters = ContainerUtil.mapNotNull(ids, new Function<String, RangeHighlighterEx>() { @Override public RangeHighlighterEx fun(String id) { return EventLogConsole.this.findHighlighter(id); } }); if (!highlighters.isEmpty()) { editor.getCaretModel().moveToOffset(highlighters.get(0).getStartOffset()); editor.getScrollingModel().scrollToCaret(ScrollType.CENTER_UP); List<Point> ranges = new ArrayList<Point>(); Point currentRange = null; DocumentEx document = editor.getDocument(); for (RangeHighlighterEx highlighter : highlighters) { int startLine = document.getLineNumber(highlighter.getStartOffset()); int endLine = document.getLineNumber(highlighter.getEndOffset()) + 1; if (currentRange != null && startLine - 1 == currentRange.y) { currentRange.y = endLine; } else { ranges.add(currentRange = new Point(startLine, endLine)); } } //noinspection UseJBColor TextAttributes attributes = new TextAttributes(null, ColorUtil.mix(editor.getBackgroundColor(), new Color(0x808080), 0.1), null, EffectType.BOXED, Font.PLAIN); MarkupModelEx markupModel = editor.getMarkupModel(); for (Point range : ranges) { int start = document.getLineStartOffset(range.x); int end = document.getLineStartOffset(range.y); myNMoreHighlighters.add(markupModel.addRangeHighlighter(start, end, HighlighterLayer.CARET_ROW + 2, attributes, HighlighterTargetArea.EXACT_RANGE)); } } }