1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193
|
Title: Style Scheme Definition Reference
# Style Scheme Definition Reference
Reference to the GtkSourceView style scheme definition file format
## Overview
This is an overview of the Style Scheme Definition XML format, describing the
meaning and usage of every element and attribute. The formal definition is
stored in the RelaxNG schema file `style.rng` which
should be installed on your system in the directory
`${PREFIX}/share/gtksourceview-5/` (where
`${PREFIX}` can be `/usr/` or
`/usr/local/` if you have installed from source).
The toplevel tag in a style scheme file is `<style-scheme>`.
It has the following attributes:
- `id` (mandatory)
Identifier for the style scheme. This is must be unique among style schemes.
- `name` (mandatory)
Name of the style scheme. This is the name of the scheme to display to user, e.g. in a preferences dialog.
- `_name`
This is the same as `name` attribute, except it will be translated. `name` and `_name` may not be used simultaneously.
- `parent-scheme` (optional)
Style schemes may have **parent** schemes: all styles but those specified
in the scheme will be taken from the parent scheme. In this way a scheme may
be customized without copying all its content.
- `version` (mandatory)
Style scheme format identifier. At the moment it must be "1.0".
- `style-scheme` tag may contain the following tags:
- `author` Name of the style scheme author.
- `description` Description of the style scheme.
- `_description` Same as `description` except it will be localized.
- `color` tags
These define color names to be used in `style` tags.
It has two attributes: `name` and `value`.
`value` is the hexadecimal color specification like
"#000000" or named color understood by Gdk prefixed with "#",
e.g. "#beige".
- `style` tags
See below for their format description.
Each `style` tag describes a single element of style scheme (it corresponds
to [class@Style] object). It has the following attributes:
- `name` (mandatory)
Name of the style. It can be anything, syntax highlighting uses **lang-id:style-id**,
and there are few special styles which are used to control general appearance
of the text. Style scheme may contain other names to be used in an application. For instance,
it may define color to highlight compilation errors in a build log or a color for
bookmarks.
- `foreground`
Foreground color. It may be name defined in one of `color` tags, or value in
hexadecimal format, e.g. "#000000", or symbolic name understood
by Gdk, prefixed with "#", e.g. "#magenta" or "#darkred".
- `background`
Background color.
- `italic`: `true` or `false`
- `bold`: `true` or `false`
- `weight`
The weight attribute was added in GtkSourceView 5.4.
The weight of the matched text block. The default value is "normal" but
you may use any of the [enum@Pango.Weight] nicks or optionally a numeric
value equivalent to the weights of CSS.
Setting this value will override any setting of "bold".
- `underline`
Accepts the values supported by [enum@Pango.Underline] ("none", "single",
"double", "low", "error"). GtkSourceView versions <= 3.16 only
supported `true` or `false` and such value are still accepted
for backward compatibility.
- `underline-color`
Underline color.
- `strikethrough`: `true` or `false`
- `scale`
Scale the matched text block. Possible values are a float number as factor
(e.g. `"1.75"`) or one of the values `"xx-small"`, `"x-small"`, `"small"`, `"medium"`, `"large"`,`"x-large"`,`"xx-large"`.
The following are names of styles which control GtkSourceView appearance:
- `text`
Default style of text.
- `selection`
Style of selected text.
- `selection-unfocused`
Style of selected text when the widget doesn't have input focus.
- `cursor`
Text cursor style. Only the `foreground` attribute is used for this style.
- `secondary-cursor`
Secondary cursor style (used in bidirectional text). Only the
`foreground` attribute is used for this style. If this is not set
while "cursor" is, then a color between text background and cursor colors is
chosen, so it is enough to use "cursor" style only.
- `current-line`
Current line style. Only the `background` attribute is used.
- `line-numbers`
Text and background colors for the left margin, on which line
numbers are drawn.
- `line-numbers-border`
Background color for the border between the left gutter and
textview.
- `current-line-number`
Current line style for the left margin, on which the current
line number is drawn. The `background`, `foreground`, and
`bold` attributes may be used. `foreground` and `bold` were
added in GtkSourceView 5.4. If `bold` is unset, it defaults
to `true`.
- `bracket-match`
Style to use for matching brackets.
- `bracket-mismatch`
Style to use for mismatching brackets.
- `right-margin`
Style to use for the right margin. The `foreground` attribute is used for
drawing the vertical line. And the `background` attribute is used for the background on
the right side of the margin. An alpha channel is applied to the two colors. For a light style
scheme, a good color for both attributes is black. For a dark style scheme, white is a good
choice.
- `draw-spaces`
Style to use for drawing spaces (special symbols for a space, a tabulation, etc).
Only the `foreground` attribute is used.
- `background-pattern`
Style to use for drawing a background pattern, for example a
grid. Only the `background` attribute is used.
## Default style schemes
The GtkSourceView team prefers to just keep a small number of style schemes
distributed with the library. To add a new style scheme in GtkSourceView
itself, the style scheme must be very popular, and ideally a
GtkSourceView-based application must use it by default.
|