Plugin colors
Prev | Chapter 19. Plugin Tips and Techniques |

## Plugin colors

There are a number of colors used by the View that should also be used by plugins where possible. This helps promote a consistent color scheme throughout jEdit.

The main color properties are:

- `view.bgColor` - the background color of the main text area

- `view.fgColor` - the base foreground color for text in the main text area

- `view.lineHighlightColor` - color of the current line highlight

- `view.selectionColor` - the color of selected text in the main text area

- `view.caretColor` - the color of the caret in the main text area

- `view.eolMarkerColor` - the color of the end-of-line marker

To use these colors in your plugin, use

    jEdit.getColorProperty("view.whatever", default_color)

For example, the QuickNotepad example should have lines like this:

            textarea.setBackground(jEdit.getColorProperty("view.bgColor", Color.WHITE);
            textarea.setForeground(jEdit.getColorProperty("view.fgColor", Color.BLACK);

This sets the foreground and background colors of QuickNotepad to be the same as those in the View.

There are other color properties that may be useful, depending on what your plugin displays.

Gutter colors:

- `view.gutter.bgColor`

- `view.gutter.currentLineColor`

- `view.gutter.fgColor`

- `view.gutter.focusBorderColor`

- `view.gutter.foldColor`

- `view.gutter.highlightColor`

- `view.gutter.markerColor`

- `view.gutter.noFocusBorderColor`

- `view.gutter.registerColor`

- `view.gutter.structureHighlightColor`

Status bar colors:

- `view.status.background`

- `view.status.foreground`

- `view.status.memory.background`

- `view.status.memory.foreground`

Structure highlight colors:

- `view.structureHighlightColor`

- `view.structureHighlightColor`

Style colors. Use `GUIUtilities.parseStyle` for these.

- `view.style.comment1`

- `view.style.comment2`

- `view.style.comment3`

- `view.style.comment4`

- `view.style.digit`

- `view.style.foldLine.0`

- `view.style.foldLine.1`

- `view.style.foldLine.2`

- `view.style.foldLine.3`

- `view.style.function`

- `view.style.invalid`

- `view.style.keyword1`

- `view.style.keyword2`

- `view.style.keyword3`

- `view.style.keyword4`

- `view.style.label`

- `view.style.literal1`

- `view.style.literal2`

- `view.style.literal3`

- `view.style.literal4`

- `view.style.markup`

- `view.style.operator`

- `view.wrapGuideColor`

For example, here is a setting for a fold line color:

             view.style.foldLine.0=color\:\#000000 bgColor\:\#f5deb8 style\:b

Passing the value to `GUIUtilities.parseStyle` will return a SyntaxStyle object, which you can query for background color, foreground color, and font.

Prev | Up |
Storing plugin data | Home |