Java Code Examples for com.intellij.openapi.editor.colors.EditorColorsScheme#getDefaultBackground()
The following examples show how to use
com.intellij.openapi.editor.colors.EditorColorsScheme#getDefaultBackground() .
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: FocusModeModel.java From consulo with Apache License 2.0 | 6 votes |
private void applyFocusMode(@Nonnull Segment focusRange) { EditorColorsScheme scheme = ObjectUtils.notNull(myEditor.getColorsScheme(), EditorColorsManager.getInstance().getGlobalScheme()); Color background = scheme.getDefaultBackground(); //noinspection UseJBColor Color foreground = Registry.getColor(ColorUtil.isDark(background) ? "editor.focus.mode.color.dark" : "editor.focus.mode.color.light", Color.GRAY); TextAttributes attributes = new TextAttributes(foreground, background, background, LINE_UNDERSCORE, Font.PLAIN); myEditor.putUserData(FOCUS_MODE_ATTRIBUTES, attributes); MarkupModel markupModel = myEditor.getMarkupModel(); DocumentEx document = myEditor.getDocument(); int textLength = document.getTextLength(); int start = focusRange.getStartOffset(); int end = focusRange.getEndOffset(); if (start <= textLength) myFocusModeMarkup.add(markupModel.addRangeHighlighter(0, start, LAYER, attributes, EXACT_RANGE)); if (end <= textLength) myFocusModeMarkup.add(markupModel.addRangeHighlighter(end, textLength, LAYER, attributes, EXACT_RANGE)); myFocusModeRange = document.createRangeMarker(start, end); }
Example 2
Source File: SyntaxInfoBuilder.java From consulo with Apache License 2.0 | 6 votes |
private MarkupModelRangeIterator(@Nullable MarkupModel markupModel, @Nonnull EditorColorsScheme colorsScheme, int startOffset, int endOffset) { myStartOffset = startOffset; myEndOffset = endOffset; myColorsScheme = colorsScheme; myDefaultForeground = colorsScheme.getDefaultForeground(); myDefaultBackground = colorsScheme.getDefaultBackground(); myUnsupportedModel = !(markupModel instanceof MarkupModelEx); if (myUnsupportedModel) { myIterator = null; return; } myIterator = ((MarkupModelEx)markupModel).overlappingIterator(startOffset, endOffset); try { findNextSuitableRange(); } catch (RuntimeException | Error e) { myIterator.dispose(); throw e; } }
Example 3
Source File: HTMLTextPainter.java From consulo with Apache License 2.0 | 6 votes |
private void writeHeader(@NonNls Writer writer, String title) throws IOException { EditorColorsScheme scheme = EditorColorsManager.getInstance().getGlobalScheme(); writer.write("<html>\r\n"); writer.write("<head>\r\n"); writer.write("<title>" + title + "</title>\r\n"); writer.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\r\n"); writeStyles(writer); writer.write("</head>\r\n"); Color color = scheme.getDefaultBackground(); if (color==null) color = JBColor.GRAY; writer.write("<BODY BGCOLOR=\"#" + Integer.toString(color.getRGB() & 0xFFFFFF, 16) + "\">\r\n"); writer.write("<TABLE CELLSPACING=0 CELLPADDING=5 COLS=1 WIDTH=\"100%\" BGCOLOR=\"#C0C0C0\" >\r\n"); writer.write("<TR><TD><CENTER>\r\n"); writer.write("<FONT FACE=\"Arial, Helvetica\" COLOR=\"#000000\">\r\n"); writer.write(title + "</FONT>\r\n"); writer.write("</center></TD></TR></TABLE>\r\n"); writer.write("<pre>\r\n"); }
Example 4
Source File: EditorFragmentComponent.java From consulo with Apache License 2.0 | 5 votes |
public static Color getBackgroundColor(Editor editor, boolean useCaretRowBackground) { EditorColorsScheme colorsScheme = editor.getColorsScheme(); Color color = colorsScheme.getColor(EditorColors.CARET_ROW_COLOR); if (!useCaretRowBackground || color == null) { color = colorsScheme.getDefaultBackground(); } return color; }
Example 5
Source File: SyntaxInfoBuilder.java From consulo with Apache License 2.0 | 5 votes |
CompositeRangeIterator(@Nonnull EditorColorsScheme colorsScheme, RangeIterator... iterators) { myDefaultForeground = colorsScheme.getDefaultForeground(); myDefaultBackground = colorsScheme.getDefaultBackground(); myIterators = new IteratorWrapper[iterators.length]; for (int i = 0; i < iterators.length; i++) { myIterators[i] = new IteratorWrapper(iterators[i], i); } }
Example 6
Source File: SyntaxInfoBuilder.java From consulo with Apache License 2.0 | 5 votes |
Context(@Nonnull CharSequence charSequence, @Nonnull EditorColorsScheme scheme, int indentSymbolsToStrip) { myText = charSequence; myDefaultForeground = scheme.getDefaultForeground(); myDefaultBackground = scheme.getDefaultBackground(); int javaFontSize = scheme.getEditorFontSize(); float fontSize = SystemInfo.isMac || ApplicationManager.getApplication().isHeadlessEnvironment() ? javaFontSize : javaFontSize * 0.75f / UISettings.getDefFontScale(); // matching font size in external apps builder = new SyntaxInfo.Builder(myDefaultForeground, myDefaultBackground, fontSize); myIndentSymbolsToStrip = indentSymbolsToStrip; }
Example 7
Source File: RecentLocationsRenderer.java From consulo with Apache License 2.0 | 4 votes |
@Nonnull private static Color getBackgroundColor(@Nonnull EditorColorsScheme colorsScheme, boolean selected) { return selected ? HintUtil.getRecentLocationsSelectionColor(colorsScheme) : colorsScheme.getDefaultBackground(); }