本文整理汇总了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;
}
示例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(" ", 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;
}
示例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);
}
示例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;
}
示例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;
}
示例6: setErrorHtml
import com.intellij.ui.ColorUtil; //导入方法依赖的package包/类
/** Wraps the given string in <html> and </html> 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);
}
}
示例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);
}
}
});
}
}
示例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();
}
示例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()));
}
示例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;}");
}
}
示例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;
}
示例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();
}
示例13: fun
import com.intellij.ui.ColorUtil; //导入方法依赖的package包/类
@Override
public String fun(Color color) {
return '#' + ColorUtil.toHex(color);
}
示例14: setNotificationsColor
import com.intellij.ui.ColorUtil; //导入方法依赖的package包/类
public void setNotificationsColor(final Color notificationsColor) {
this.notificationsColor = ColorUtil.toHex(notificationsColor);
}
示例15: setBackgroundColor
import com.intellij.ui.ColorUtil; //导入方法依赖的package包/类
public void setBackgroundColor(final Color backgroundColor) {
this.backgroundColor = ColorUtil.toHex(backgroundColor);
}