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


Java ColorUtil.toHex方法代码示例

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


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

示例1: createTaskInfoPanel

import com.intellij.ui.ColorUtil; //导入方法依赖的package包/类
@Override
public JComponent createTaskInfoPanel(Project project) {
  myTaskTextPane = new JTextPane();
  final JBScrollPane scrollPane = new JBScrollPane(myTaskTextPane);
  myTaskTextPane.setContentType(new HTMLEditorKit().getContentType());
  final EditorColorsScheme editorColorsScheme = EditorColorsManager.getInstance().getGlobalScheme();
  int fontSize = editorColorsScheme.getEditorFontSize();
  final String fontName = editorColorsScheme.getEditorFontName();
  final Font font = new Font(fontName, Font.PLAIN, fontSize);
  String bodyRule = "body { font-family: " + font.getFamily() + "; " +
                    "font-size: " + font.getSize() + "pt; }" +
                    "pre {font-family: Courier; display: inline; ine-height: 50px; padding-top: 5px; padding-bottom: 5px; padding-left: 5px; background-color:"
                    + ColorUtil.toHex(ColorUtil.dimmer(UIUtil.getPanelBackground())) + ";}" +
                    "code {font-family: Courier; display: flex; float: left; background-color:"
                    + ColorUtil.toHex(ColorUtil.dimmer(UIUtil.getPanelBackground())) + ";}";
  ((HTMLDocument)myTaskTextPane.getDocument()).getStyleSheet().addRule(bodyRule);
  myTaskTextPane.setEditable(false);
  if (!UIUtil.isUnderDarcula()) {
    myTaskTextPane.setBackground(EditorColorsManager.getInstance().getGlobalScheme().getDefaultBackground());
  }
  myTaskTextPane.setBorder(new EmptyBorder(20, 20, 0, 10));
  myTaskTextPane.addHyperlinkListener(BrowserHyperlinkListener.INSTANCE);
  return scrollPane;
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:25,代码来源:StudySwingToolWindow.java

示例2: getCommitterText

import com.intellij.ui.ColorUtil; //导入方法依赖的package包/类
@Nonnull
private static String getCommitterText(@Nullable VcsUser committer, @Nonnull String commitTimeText, int offset) {
  String alignment = "<br/>" + StringUtil.repeat("&nbsp;", offset);
  String gray = ColorUtil.toHex(JBColor.GRAY);

  String graySpan = "<span style='color:#" + gray + "'>";

  String text = alignment + graySpan + "committed";
  if (committer != null) {
    text += " by " + VcsUserUtil.getShortPresentation(committer);
    if (!committer.getEmail().isEmpty()) {
      text += "</span>" + getEmailText(committer) + graySpan;
    }
  }
  text += commitTimeText + "</span>";
  return text;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:18,代码来源:CommitPanel.java

示例3: buildHtml

import com.intellij.ui.ColorUtil; //导入方法依赖的package包/类
@Nonnull
public static String buildHtml(@Nonnull final Notification notification,
                               @Nullable String style,
                               boolean isContent,
                               @Nullable Color color,
                               @Nullable String contentStyle) {
  String title = !isContent ? notification.getTitle() : "";
  String subtitle = !isContent ? notification.getSubtitle() : null;
  String content = isContent ? notification.getContent() : "";
  if (title.length() > TITLE_LIMIT || StringUtil.length(subtitle) > TITLE_LIMIT || content.length() > CONTENT_LIMIT) {
    LOG.info("Too large notification " + notification + " of " + notification.getClass() +
             "\nListener=" + notification.getListener() +
             "\nTitle=" + title +
             "\nSubtitle=" + subtitle +
             "\nContent=" + content);
    title = StringUtil.trimLog(title, TITLE_LIMIT);
    subtitle = StringUtil.trimLog(StringUtil.notNullize(subtitle), TITLE_LIMIT);
    content = StringUtil.trimLog(content, CONTENT_LIMIT);
  }
  if (isContent) {
    content = StringUtil.replace(content, "<p/>", "<br>");
  }
  String colorText = color == null ? null : "#" + ColorUtil.toHex(color);
  return buildHtml(title, subtitle, content, style, isContent ? null : colorText, isContent ? colorText : null, contentStyle);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:26,代码来源:NotificationsUtil.java

示例4: getSelectedColorName

import com.intellij.ui.ColorUtil; //导入方法依赖的package包/类
@Nullable
public String getSelectedColorName() {
  for (String name : myColorToButtonMap.keySet()) {
    ColorButton button = myColorToButtonMap.get(name);
    if (!button.isSelected()) continue;
    if (button instanceof CustomColorButton) {
      final String color = ColorUtil.toHex(button.getColor());
      String colorName  = findColorName(button.getColor());
      return colorName == null ? color : colorName;
    }
    return name;
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:ColorSelectionComponent.java

示例5: findColorName

import com.intellij.ui.ColorUtil; //导入方法依赖的package包/类
@Nullable
public static String findColorName(Color color) {
  final String hex = ColorUtil.toHex(color);
  if ("ffffe4".equals(hex) || "494539".equals(hex)) {
    return "Yellow";
  }

  if ("e7fadb".equals(hex) || "2a3b2c".equals(hex)) {
    return "Green";
  }

  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:ColorSelectionComponent.java

示例6: setErrorHtml

import com.intellij.ui.ColorUtil; //导入方法依赖的package包/类
/** Wraps the given string in &lt;html&gt; and &lt;/html&gt; tags and sets it into the error label. */
public void setErrorHtml(@Nullable String s) {
  if (s == null) {
    s = "";
  }
  if (!s.startsWith("<html>")) {
    s = "<html><font color='#" + ColorUtil.toHex(JBColor.RED) + "'>" + XmlUtils.toXmlTextValue(s) + "</font></html>";
    s.replaceAll("\n", "<br>");
  }
  JLabel label = getError();
  if (label != null) {
    label.setText(s);
    growLabelIfNecessary(label);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:TemplateWizardStep.java

示例7: initPluginsPanel

import com.intellij.ui.ColorUtil; //导入方法依赖的package包/类
protected void initPluginsPanel(final JPanel panel, JPanel pluginsPanel, JEditorPane updateLinkPane) {
  pluginsPanel.setVisible(myUploadedPlugins != null);
  if (myUploadedPlugins != null) {
    final DetectedPluginsPanel foundPluginsPanel = new DetectedPluginsPanel();

    foundPluginsPanel.addStateListener(new DetectedPluginsPanel.Listener() {
      public void stateChanged() {
        setButtonsText();
      }
    });
    for (PluginDownloader uploadedPlugin : myUploadedPlugins) {
      foundPluginsPanel.add(uploadedPlugin);
    }
    TableUtil.ensureSelectionExists(foundPluginsPanel.getEntryTable());
    pluginsPanel.add(foundPluginsPanel, BorderLayout.CENTER);
  }
  updateLinkPane.setBackground(UIUtil.getPanelBackground());
  String css = UIUtil.getCssFontDeclaration(UIUtil.getLabelFont());
  if (UIUtil.isUnderDarcula()) {
    css += "<style>body {background: #" + ColorUtil.toHex(UIUtil.getPanelBackground()) + ";}</style>";
  }
  updateLinkPane.setBorder(IdeBorderFactory.createEmptyBorder());
  updateLinkPane.setText(IdeBundle.message("updates.configure.label", css));
  updateLinkPane.setEditable(false);
  LabelTextReplacingUtil.replaceText(panel);

  if (myEnableLink) {
    updateLinkPane.addHyperlinkListener(new HyperlinkListener() {
      public void hyperlinkUpdate(final HyperlinkEvent e) {
        if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
          final ShowSettingsUtil util = ShowSettingsUtil.getInstance();
          UpdateSettingsConfigurable updatesSettings = new UpdateSettingsConfigurable();
          updatesSettings.setCheckNowEnabled(false);
          util.editConfigurable(panel, updatesSettings);
        }
      }
    });
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:40,代码来源:AbstractUpdateDialog.java

示例8: appendError

import com.intellij.ui.ColorUtil; //导入方法依赖的package包/类
private void appendError(String text) {
  errors.add(text);
  myLabel.setBounds(0, 0, 0, 0);
  StringBuilder sb = new StringBuilder("<html><font color='#" + ColorUtil.toHex(JBColor.RED) + "'>");
  errors.forEach(error -> sb.append("<left>").append(error).append("</left><br/>"));
  sb.append("</font></html>");
  myLabel.setText(sb.toString());
  setVisible(true);
  updateSize();
}
 
开发者ID:consulo,项目名称:consulo,代码行数:11,代码来源:DialogWrapper.java

示例9: createRestLabel

import com.intellij.ui.ColorUtil; //导入方法依赖的package包/类
@Nonnull
@Override
protected JBLabel createRestLabel(int restSize) {
  String gray = ColorUtil.toHex(UIManager.getColor("Button.disabledText"));
  return createLabel("<html><font color=\"#" + gray + "\">... " + restSize + " more in details pane</font></html>",
                     createEmptyIcon(getIconHeight()));
}
 
开发者ID:consulo,项目名称:consulo,代码行数:8,代码来源:TooltipReferencesPanel.java

示例10: customizeLinksStyle

import com.intellij.ui.ColorUtil; //导入方法依赖的package包/类
private void customizeLinksStyle() {
  Document document = getDocument();
  if (document instanceof HTMLDocument) {
    StyleSheet styleSheet = ((HTMLDocument)document).getStyleSheet();
    String linkColor = "#" + ColorUtil.toHex(UI.getColor("link.foreground"));
    styleSheet.addRule("a { color: " + linkColor + "; text-decoration: none;}");
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:9,代码来源:CommitPanel.java

示例11: getColorName

import com.intellij.ui.ColorUtil; //导入方法依赖的package包/类
@Nullable
private String getColorName() {
  for (String name : myColorToButtonMap.keySet()) {
    final AbstractButton button = myColorToButtonMap.get(name);
    if (button.isSelected()) {
      return button instanceof CustomColorButton ? ColorUtil.toHex(((CustomColorButton)button).getColor()) : name;
    }
  }
  return null;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:11,代码来源:FileColorConfigurationEditDialog.java

示例12: prepareMessage

import com.intellij.ui.ColorUtil; //导入方法依赖的package包/类
@NotNull
private String prepareMessage() {
  StringBuilder builder = new StringBuilder("<html>");
  LayoutCodeInfoCollector notifications = myProcessor.getInfoCollector();
  LOG.assertTrue(notifications != null);

  if (notifications.isEmpty() && !myNoChangesDetected) {
    if (myProcessChangesTextOnly) {
      builder.append("No lines changed: changes since last revision are already properly formatted").append("<br>");
    }
    else {
      builder.append("No lines changed: code is already properly formatted").append("<br>");
    }
  }
  else {
    if (notifications.hasReformatOrRearrangeNotification()) {
      String reformatInfo = notifications.getReformatCodeNotification();
      String rearrangeInfo = notifications.getRearrangeCodeNotification();

      builder.append(joinWithCommaAndCapitalize(reformatInfo, rearrangeInfo));

      if (myProcessChangesTextOnly) {
        builder.append(" in changes since last revision");
      }

      builder.append("<br>");
    }
    else if (myNoChangesDetected) {
      builder.append("No lines changed: no changes since last revision").append("<br>");
    }

    String optimizeImportsNotification = notifications.getOptimizeImportsNotification();
    if (optimizeImportsNotification != null) {
      builder.append(StringUtil.capitalize(optimizeImportsNotification)).append("<br>");
    }
  }

  String shortcutText = KeymapUtil.getFirstKeyboardShortcutText(ActionManager.getInstance().getAction("ShowReformatFileDialog"));
  String color = ColorUtil.toHex(JBColor.gray);

  builder.append("<span style='color:#").append(color).append("'>")
         .append("<a href=''>Show</a> reformat dialog: ").append(shortcutText).append("</span>")
         .append("</html>");

  return builder.toString();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:47,代码来源:FileInEditorProcessor.java

示例13: fun

import com.intellij.ui.ColorUtil; //导入方法依赖的package包/类
@Override
public String fun(Color color) {
  return '#' + ColorUtil.toHex(color);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:UserColorLookup.java

示例14: setNotificationsColor

import com.intellij.ui.ColorUtil; //导入方法依赖的package包/类
public void setNotificationsColor(final Color notificationsColor) {
  this.notificationsColor = ColorUtil.toHex(notificationsColor);
}
 
开发者ID:ChrisRM,项目名称:material-theme-jetbrains,代码行数:4,代码来源:MTCustomThemeConfig.java

示例15: setBackgroundColor

import com.intellij.ui.ColorUtil; //导入方法依赖的package包/类
public void setBackgroundColor(final Color backgroundColor) {
  this.backgroundColor = ColorUtil.toHex(backgroundColor);
}
 
开发者ID:ChrisRM,项目名称:material-theme-jetbrains,代码行数:4,代码来源:MTCustomThemeConfig.java


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