how use color picker in custom language plugin?

Hi,
 
How can I enable and customize the "color picker" / "color changer" on the editor gutter and auto completion in my custom language plugin to get a functionality which is described here: https://www.jetbrains.com/help/idea/2017.1/changing-color-values-in-style-sheets.html
 
The language[1] I am working on has keywords like COLOR, BACKGROUNDCOLOR, OUTLINECOLOR, and so on followed by R-G-B values or a Hex-String.
 
Thanks for any hint!
 
4 comments
Comment actions Permalink

Hi Daniel, for most cases it's enough to implement ColorChooserService. Please try something like this:

 

<applicationService serviceInterface="com.intellij.ui.ColorChooserService"
serviceImplementation="com.your.implementation.ChooserService" overrides="true"/>

0
Comment actions Permalink

Thanks for the hint.

Having a serviceImplementation in place like https://insight.io/github.com/JetBrains/intellij-community/blob/master/platform/platform-impl/src/com/intellij/ui/ColorChooserServiceImpl.java has no effect unfortunately.

In debug-mode no breakpoint gets catch. It seems that a linking to an AstNode / PsiElement is missing.

Whats wrong here?

0
Comment actions Permalink

> has no effect unfortunately.

What effect? Sorry, I think I don't understand what you're trying to achieve.

Please describe what exactly you want to implement.

0
Comment actions Permalink

If you want just show an icon on the gutter, then the easiest way it to implement ElementColorProvider extension.

If for some reason it's not fit to your needs, you can implement either LineMarkerProvider (e.g. like ColorLineMarkerProvider) or Annotator and annotate needed elements with info annotation and your implementation of GutterIconRenderer.

0

Please sign in to leave a comment.