当前位置: 首页>>代码示例>>Java>>正文


Java ColorUtil.mix方法代码示例

本文整理汇总了Java中com.intellij.ui.ColorUtil.mix方法的典型用法代码示例。如果您正苦于以下问题:Java ColorUtil.mix方法的具体用法?Java ColorUtil.mix怎么用?Java ColorUtil.mix使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.ui.ColorUtil的用法示例。


在下文中一共展示了ColorUtil.mix方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: VcsLogColorManagerImpl

import com.intellij.ui.ColorUtil; //导入方法依赖的package包/类
public VcsLogColorManagerImpl(@Nonnull Collection<VirtualFile> roots) {
  myRoots = new ArrayList<>(roots);
  Collections.sort(myRoots, Comparator.comparing(VirtualFile::getName));
  myRoots2Colors = ContainerUtil.newHashMap();
  int i = 0;
  for (VirtualFile root : myRoots) {
    Color color;
    if (i >= ROOT_COLORS.length) {
      double balance = ((double)(i / ROOT_COLORS.length)) / (roots.size() / ROOT_COLORS.length);
      Color mix = ColorUtil.mix(ROOT_COLORS[i % ROOT_COLORS.length], ROOT_COLORS[(i + 1) % ROOT_COLORS.length], balance);
      int tones = (int)(Math.abs(balance - 0.5) * 2 * (roots.size() / ROOT_COLORS.length) + 1);
      color = new JBColor(ColorUtil.darker(mix, tones), ColorUtil.brighter(mix, 2 * tones));
    }
    else {
      color = ROOT_COLORS[i];
    }
    i++;
    myRoots2Colors.put(root, color);
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:21,代码来源:VcsLogColorManagerImpl.java

示例2: calculateGreyBackground

import com.intellij.ui.ColorUtil; //导入方法依赖的package包/类
@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;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:23,代码来源:LabelPainter.java

示例3: createStatusHighlighter

import com.intellij.ui.ColorUtil; //导入方法依赖的package包/类
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);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:27,代码来源:ApplyPatchChange.java

示例4: getTopBorderColor

import com.intellij.ui.ColorUtil; //导入方法依赖的package包/类
@Nullable
private static Color getTopBorderColor(int i, int lineHeight, @NotNull 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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:DiffLineSeparatorRenderer.java

示例5: getBottomBorderColor

import com.intellij.ui.ColorUtil; //导入方法依赖的package包/类
@Nullable
private static Color getBottomBorderColor(int i, int lineHeight, @NotNull 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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:DiffLineSeparatorRenderer.java

示例6: getBackgroundColor

import com.intellij.ui.ColorUtil; //导入方法依赖的package包/类
@NotNull
public static JBColor getBackgroundColor(@NotNull final Color baseRootColor) {
  return new JBColor(new NotNullProducer<Color>() {
    @NotNull
    @Override
    public Color produce() {
      return ColorUtil.mix(baseRootColor, UIUtil.getTableBackground(), 0.75);
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:VcsLogColorManagerImpl.java

示例7: getTopBorderColor

import com.intellij.ui.ColorUtil; //导入方法依赖的package包/类
@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);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:13,代码来源:DiffLineSeparatorRenderer.java

示例8: getBottomBorderColor

import com.intellij.ui.ColorUtil; //导入方法依赖的package包/类
@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);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:16,代码来源:DiffLineSeparatorRenderer.java

示例9: getShortcutColor

import com.intellij.ui.ColorUtil; //导入方法依赖的package包/类
@SuppressWarnings("UseJBColor")
private Color getShortcutColor(@NotNull Color background, @NotNull Color foreground) {
    return ColorUtil.mix(background, foreground, 0.5);
}
 
开发者ID:dyadix,项目名称:typengo,代码行数:5,代码来源:CommandInputForm.java

示例10: getSelectionBackground

import com.intellij.ui.ColorUtil; //导入方法依赖的package包/类
@NotNull
protected static Color getSelectionBackground() {
  return ColorUtil.mix(UIUtil.getListSelectionBackground(), UIUtil.getLabelBackground(), UIUtil.isUnderDarcula() ? .5 : .75);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:AbstractCustomizeWizardStep.java

示例11: getBackgroundColor

import com.intellij.ui.ColorUtil; //导入方法依赖的package包/类
@Nonnull
public static JBColor getBackgroundColor(@Nonnull final Color baseRootColor) {
  return new JBColor(() -> ColorUtil.mix(baseRootColor, UIUtil.getTableBackground(), 0.75));
}
 
开发者ID:consulo,项目名称:consulo,代码行数:5,代码来源:VcsLogColorManagerImpl.java

示例12: getSelectionBackground

import com.intellij.ui.ColorUtil; //导入方法依赖的package包/类
@Nonnull
protected static Color getSelectionBackground() {
  return ColorUtil.mix(UIUtil.getListSelectionBackground(), UIUtil.getLabelBackground(), UIUtil.isUnderDarcula() ? .5 : .75);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:5,代码来源:AbstractCustomizeWizardStep.java

示例13: showNotification

import com.intellij.ui.ColorUtil; //导入方法依赖的package包/类
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));
    }
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:45,代码来源:EventLogConsole.java


注:本文中的com.intellij.ui.ColorUtil.mix方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。