Search in sources :

Example 1 with ColorKey

use of com.intellij.openapi.editor.colors.ColorKey in project intellij-community by JetBrains.

the class XmlTagTreeHighlightingUtil method getBaseColors.

static Color[] getBaseColors() {
    final ColorKey[] colorKeys = XmlTagTreeHighlightingColors.getColorKeys();
    final Color[] colors = new Color[colorKeys.length];
    final EditorColorsScheme colorsScheme = EditorColorsManager.getInstance().getGlobalScheme();
    for (int i = 0; i < colors.length; i++) {
        colors[i] = colorsScheme.getColor(colorKeys[i]);
    }
    return colors;
}
Also used : ColorKey(com.intellij.openapi.editor.colors.ColorKey) EditorColorsScheme(com.intellij.openapi.editor.colors.EditorColorsScheme)

Example 2 with ColorKey

use of com.intellij.openapi.editor.colors.ColorKey in project intellij-community by JetBrains.

the class AnnotationsSettings method getAnchorIndexes.

@NotNull
List<Integer> getAnchorIndexes(@Nullable EditorColorsScheme scheme) {
    if (scheme == null)
        scheme = EditorColorsManager.getInstance().getGlobalScheme();
    List<Integer> result = new ArrayList<>(ANCHORS_COUNT);
    int count = 0;
    for (ColorKey key : ANCHOR_COLOR_KEYS) {
        if (scheme.getColor(key) != null) {
            result.add(count);
            count += COLORS_BETWEEN_ANCHORS + 1;
        } else {
            result.add(null);
        }
    }
    return result;
}
Also used : ColorKey(com.intellij.openapi.editor.colors.ColorKey) ArrayList(java.util.ArrayList) NotNull(org.jetbrains.annotations.NotNull)

Example 3 with ColorKey

use of com.intellij.openapi.editor.colors.ColorKey in project intellij-community by JetBrains.

the class VcsColorsPageFactory method getColorDescriptors.

@Override
@NotNull
public ColorDescriptor[] getColorDescriptors() {
    List<ColorDescriptor> descriptors = new ArrayList<>();
    descriptors.add(new ColorDescriptor(OptionsBundle.message("options.general.color.descriptor.added.lines"), EditorColors.ADDED_LINES_COLOR, ColorDescriptor.Kind.BACKGROUND));
    descriptors.add(new ColorDescriptor(OptionsBundle.message("options.general.color.descriptor.modified.lines"), EditorColors.MODIFIED_LINES_COLOR, ColorDescriptor.Kind.BACKGROUND));
    descriptors.add(new ColorDescriptor(OptionsBundle.message("options.general.color.descriptor.deleted.lines"), EditorColors.DELETED_LINES_COLOR, ColorDescriptor.Kind.BACKGROUND));
    descriptors.add(new ColorDescriptor(OptionsBundle.message("options.general.color.descriptor.whitespaces.modified.lines"), EditorColors.WHITESPACES_MODIFIED_LINES_COLOR, ColorDescriptor.Kind.BACKGROUND));
    descriptors.add(new ColorDescriptor(OptionsBundle.message("options.general.color.descriptor.border.lines"), EditorColors.BORDER_LINES_COLOR, ColorDescriptor.Kind.BACKGROUND));
    descriptors.add(new ColorDescriptor(OptionsBundle.message("options.general.color.descriptor.vcs.annotations"), EditorColors.ANNOTATIONS_COLOR, ColorDescriptor.Kind.FOREGROUND));
    List<ColorKey> colorKeys = AnnotationsSettings.ANCHOR_COLOR_KEYS;
    for (int i = 0; i < colorKeys.size(); i++) {
        descriptors.add(new ColorDescriptor(OptionsBundle.message("options.general.color.descriptor.vcs.annotations.color.n", i + 1), colorKeys.get(i), ColorDescriptor.Kind.BACKGROUND));
    }
    return ArrayUtil.toObjectArray(descriptors, ColorDescriptor.class);
}
Also used : ColorDescriptor(com.intellij.openapi.options.colors.ColorDescriptor) ColorKey(com.intellij.openapi.editor.colors.ColorKey) ArrayList(java.util.ArrayList) NotNull(org.jetbrains.annotations.NotNull)

Example 4 with ColorKey

use of com.intellij.openapi.editor.colors.ColorKey in project intellij-community by JetBrains.

the class EditorGutterComponentImpl method getOutlineColor.

private Color getOutlineColor(boolean isActive) {
    ColorKey key = isActive ? EditorColors.SELECTED_TEARLINE_COLOR : EditorColors.TEARLINE_COLOR;
    Color color = myEditor.getColorsScheme().getColor(key);
    return color != null ? color : JBColor.black;
}
Also used : ColorKey(com.intellij.openapi.editor.colors.ColorKey) JBColor(com.intellij.ui.JBColor)

Example 5 with ColorKey

use of com.intellij.openapi.editor.colors.ColorKey in project intellij-community by JetBrains.

the class EditorColorsSchemeImpl method compareColors.

private boolean compareColors(@NotNull AbstractColorsScheme otherScheme, @NotNull Collection<Function<ColorKey, Boolean>> filters) {
    for (ColorKey key : myColorsMap.keySet()) {
        Color thisColor = getColor(key);
        Color otherColor = otherScheme.getColor(key);
        if (thisColor == null) {
            return otherColor == null;
        }
        if (!isColorKeyIgnored(filters, key) && !thisColor.equals(otherColor)) {
            return false;
        }
    }
    filters.add(key -> myColorsMap.containsKey(key));
    if (myParentScheme instanceof EditorColorsSchemeImpl && !((EditorColorsSchemeImpl) myParentScheme).compareColors(otherScheme, filters)) {
        return false;
    }
    return true;
}
Also used : ColorKey(com.intellij.openapi.editor.colors.ColorKey)

Aggregations

ColorKey (com.intellij.openapi.editor.colors.ColorKey)7 NotNull (org.jetbrains.annotations.NotNull)3 ColorDescriptor (com.intellij.openapi.options.colors.ColorDescriptor)2 ArrayList (java.util.ArrayList)2 EditorColorsScheme (com.intellij.openapi.editor.colors.EditorColorsScheme)1 JBColor (com.intellij.ui.JBColor)1