Java Code Examples for com.intellij.ui.JBColor#WHITE

The following examples show how to use com.intellij.ui.JBColor#WHITE . 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: ProfilerPanel.java    From intellij-plugin-v4 with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
public Token addDecisionEventHighlighter(PreviewState previewState, MarkupModel markupModel,
                                         DecisionEventInfo info, Color errorStripeColor,
                                         EffectType effectType) {
	TokenStream tokens = previewState.parsingResult.parser.getInputStream();
	Token startToken = tokens.get(info.startIndex);
	Token stopToken = tokens.get(info.stopIndex);
	TextAttributes textAttributes =
		new TextAttributes(JBColor.BLACK, JBColor.WHITE, errorStripeColor,
		                   effectType, Font.PLAIN);
	textAttributes.setErrorStripeColor(errorStripeColor);
	final RangeHighlighter rangeHighlighter =
		markupModel.addRangeHighlighter(
			startToken.getStartIndex(), stopToken.getStopIndex()+1,
			HighlighterLayer.ADDITIONAL_SYNTAX, textAttributes,
			HighlighterTargetArea.EXACT_RANGE);
	rangeHighlighter.putUserData(DECISION_EVENT_INFO_KEY, info);
	rangeHighlighter.setErrorStripeMarkColor(errorStripeColor);
	return startToken;
}
 
Example 2
Source File: LineParser.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private static Object toStyle(String str) {
  switch (str) {
    case "1":
      return SimpleTextAttributes.STYLE_BOLD;
    case "3":
      return SimpleTextAttributes.STYLE_ITALIC;
    case "4":
      return SimpleTextAttributes.STYLE_UNDERLINE;
    case "9":
      return SimpleTextAttributes.STYLE_STRIKEOUT;
    case "30":
      return JBColor.BLACK;
    case "31":
      return JBColor.RED;
    case "32":
      return JBColor.GREEN;
    case "33":
      return JBColor.YELLOW;
    case "34":
      return JBColor.BLUE;
    case "35":
      return JBColor.MAGENTA;
    case "36":
      return JBColor.CYAN;
    case "37":
      return JBColor.WHITE;
    case "38":
      return JBColor.GRAY;
    default:
      return null;
  }
}
 
Example 3
Source File: LineParser.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private static Object toStyle(String str) {
  switch (str) {
    case "1":
      return SimpleTextAttributes.STYLE_BOLD;
    case "3":
      return SimpleTextAttributes.STYLE_ITALIC;
    case "4":
      return SimpleTextAttributes.STYLE_UNDERLINE;
    case "9":
      return SimpleTextAttributes.STYLE_STRIKEOUT;
    case "30":
      return JBColor.BLACK;
    case "31":
      return JBColor.RED;
    case "32":
      return JBColor.GREEN;
    case "33":
      return JBColor.YELLOW;
    case "34":
      return JBColor.BLUE;
    case "35":
      return JBColor.MAGENTA;
    case "36":
      return JBColor.CYAN;
    case "37":
      return JBColor.WHITE;
    case "38":
      return JBColor.GRAY;
    default:
      return null;
  }
}
 
Example 4
Source File: PopupListElementRendererWithIcon.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
protected JComponent createItemComponent() {
  myTextLabel = new ErrorLabel();
  myTextLabel.setOpaque(true);
  myTextLabel.setBorder(JBUI.Borders.empty(1));

  myIconLabel = new IconComponent();

  JPanel panel = new OpaquePanel(new BorderLayout(), JBColor.WHITE);
  panel.add(myIconLabel, BorderLayout.WEST);
  panel.add(myTextLabel, BorderLayout.CENTER);
  return layoutComponent(panel);
}
 
Example 5
Source File: SuggestionTreeCellRenderer.java    From size-analyzer with Apache License 2.0 4 votes vote down vote up
@Override
public Component getTreeCellRendererComponent(
    JTree tree,
    Object value,
    boolean selected,
    boolean expanded,
    boolean leaf,
    int row,
    boolean hasFocus) {
  final Component rendererComponent =
      parentRenderer.getTreeCellRendererComponent(
          tree, value, selected, expanded, leaf, row, hasFocus);
  if (rendererComponent instanceof SimpleColoredComponent) {
    Object nodeObject = ((DefaultMutableTreeNode) value).getUserObject();
    for (SimpleColoredComponent.ColoredIterator it =
        ((SimpleColoredComponent) rendererComponent).iterator();
        it.hasNext(); ) {
      it.next();
      int offset = it.getOffset();
      int endOffset = it.getEndOffset();
      if (selected) {
        if (nodeObject instanceof CategoryData) {
          it.split(
              endOffset - offset,
              new SimpleTextAttributes(SimpleTextAttributes.STYLE_BOLD, JBColor.WHITE));
        } else if (nodeObject instanceof SuggestionData || nodeObject instanceof IssueTypeData) {
          it.split(
              endOffset - offset,
              new SimpleTextAttributes(SimpleTextAttributes.STYLE_PLAIN, JBColor.WHITE));
        }
      } else {
        if (nodeObject instanceof CategoryData) {
          it.split(endOffset - offset, SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES);
        }
      }
    }

    SimpleTextAttributes annotationStyle =
        selected
            ? new SimpleTextAttributes(SimpleTextAttributes.STYLE_PLAIN, JBColor.WHITE)
            : SimpleTextAttributes.GRAYED_ATTRIBUTES;
    if (nodeObject instanceof CategoryData) {
      CategoryData category = (CategoryData) nodeObject;
      ((SimpleColoredComponent) rendererComponent)
          .append(
              "  " + category.totalSuggestions(), annotationStyle);
      ((SimpleColoredComponent) rendererComponent)
          .append(
              category.totalSuggestions() == 1 ? " recommendation" : " recommendations",
              annotationStyle);
      if (category.totalSizeSaved() != null) {
        ((SimpleColoredComponent) rendererComponent)
            .append(", " + category.totalSizeSaved(), annotationStyle);
      }
    } else if (nodeObject instanceof IssueTypeData) {
      IssueTypeData issueType = (IssueTypeData) nodeObject;
      if (issueType.totalSuggestions() == 1) {
        ((SimpleColoredComponent) rendererComponent)
            .append(
                "  " + issueType.totalSuggestions() + " recommendation", annotationStyle);
      } else {
        ((SimpleColoredComponent) rendererComponent)
            .append(
                "  " + issueType.totalSuggestions() + " recommendations", annotationStyle);
      }
      if (issueType.totalSizeSaved() != null) {
        ((SimpleColoredComponent) rendererComponent)
            .append(", " + issueType.totalSizeSaved(), annotationStyle);
      }
    } else if (nodeObject instanceof SuggestionData) {
      SuggestionData suggestion = (SuggestionData) nodeObject;
      if (suggestion.getBytesSaved() != null) {
        ((SimpleColoredComponent) rendererComponent)
            .append("  " + suggestion.getBytesSaved(), annotationStyle);
      }
    }
  }
  return rendererComponent;
}
 
Example 6
Source File: TestVisualization.java    From jetbrains-plugin-graph-database-support with Apache License 2.0 4 votes vote down vote up
private static LookAndFeelService mockLook() {
    return new LookAndFeelService() {
        @Override
        public Color getBackgroundColor() {
            return JBColor.BLACK;
        }

        @Override
        public Color getBorderColor() {
            return JBColor.RED;
        }

        @Override
        public Color getNodeStrokeColor() {
            return JBColor.GREEN;
        }

        @Override
        public Color getNodeStrokeHoverColor() {
            return JBColor.ORANGE;
        }

        @Override
        public Color getNodeFillColor() {
            return JBColor.CYAN;
        }

        @Override
        public Color getNodeFillHoverColor() {
            return JBColor.DARK_GRAY;
        }

        @Override
        public Color getEdgeStrokeColor() {
            return JBColor.LIGHT_GRAY;
        }

        @Override
        public Color getEdgeFillColor() {
            return JBColor.MAGENTA;
        }

        @Override
        public Color getTextColor() {
            return JBColor.WHITE;
        }

        @Override
        public boolean isGraphViewZoomInverted() {
            return true;
        }
    };
}
 
Example 7
Source File: AbstractNavBarUI.java    From consulo with Apache License 2.0 4 votes vote down vote up
private static BufferedImage drawToBuffer(NavBarItem item, JBUI.ScaleContext ctx, boolean floating, boolean toolbarVisible, boolean selected, NavBarPanel navbar) {
  int w = item.getWidth();
  int h = item.getHeight();
  int offset = (w - getDecorationOffset());
  int h2 = h / 2;

  BufferedImage result = UIUtil.createImage(ctx, w, h, BufferedImage.TYPE_INT_ARGB, PaintUtil.RoundingMode.FLOOR);

  Color defaultBg = UIUtil.isUnderDarcula() ? Gray._100 : JBColor.WHITE;
  final Paint bg = floating ? defaultBg : null;
  final Color selection = UIUtil.getListSelectionBackground(true);

  Graphics2D g2 = result.createGraphics();
  g2.setStroke(new BasicStroke(1f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND));
  g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);


  Path2D.Double shape = new Path2D.Double();
  shape.moveTo(0, 0);

  shape.lineTo(offset, 0);
  shape.lineTo(w, h2);
  shape.lineTo(offset, h);
  shape.lineTo(0, h);
  shape.closePath();

  Path2D.Double endShape = new Path2D.Double();
  endShape.moveTo(offset, 0);
  endShape.lineTo(w, 0);
  endShape.lineTo(w, h);
  endShape.lineTo(offset, h);
  endShape.lineTo(w, h2);
  endShape.closePath();

  if (bg != null && toolbarVisible) {
    g2.setPaint(bg);
    g2.fill(shape);
    g2.fill(endShape);
  }

  if (selected) {
    Path2D.Double focusShape = new Path2D.Double();
    if (toolbarVisible || floating) {
      focusShape.moveTo(offset, 0);
    }
    else {
      focusShape.moveTo(0, 0);
      focusShape.lineTo(offset, 0);
    }
    focusShape.lineTo(w - 1, h2);
    focusShape.lineTo(offset, h - 1);
    if (!toolbarVisible && !floating) {
      focusShape.lineTo(0, h - 1);

    }

    g2.setColor(selection);
    if (floating && item.isLastElement()) {
      g2.fillRect(0, 0, w, h);
    }
    else {
      g2.fill(shape);
    }
  }

  if (item.isNextSelected() && navbar.isFocused()) {
    g2.setColor(selection);
    g2.fill(endShape);
  }

  if (!item.isLastElement()) {
    if (!selected && (!navbar.isFocused() | !item.isNextSelected())) {
      Icon icon = AllIcons.Ide.NavBarSeparator;
      icon.paintIcon(item, g2, w - icon.getIconWidth() - JBUIScale.scale(1), h2 - icon.getIconHeight() / 2);
    }
  }

  g2.dispose();
  return result;
}