In libgedit-gtksourceview, a style scheme (or also called color scheme) is used for the syntax highlighting.
A style scheme file is written in XML.
The file needs to have the .xml
extension. For example:
classic.xml
The first line needs to be:
<?xml version="1.0" encoding="UTF-8"?>
A style scheme file has only one top-level element:
<style-scheme>
Example:
<style-scheme id="classic" _name="Classic" version="1.0"> <!-- ... --> </style-scheme>
The <style-scheme>
tag supports the following attributes:
id
(mandatory)id
. During the loading,
if two or more style schemes have the same id
, only one is kept
(the one with the highest priority, depending on the order in which the
files are loaded).
name
(mandatory)_name
name
attribute, except that it will be
translated. name
and _name
may not be used
simultaneously.
parent-scheme
(optional)version
(mandatory)"1.0"
.
If the format evolves, especially in incompatible ways, then the version
number will be incremented.
The style-scheme
element may contain the following elements:
author
, description
, _description
,
color
and style
.
Name of the style scheme author or team. Example:
<author>Gedit Technology dream team</author>
Description of the style scheme. The <description>
value is
not translated, while <_description>
is. Example:
<_description>Classic color scheme</_description>
The <color>
tags 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".
Each <style>
tag describes a single element of style scheme
(it corresponds to a GtkSourceStyle
object in the library API).
A <style>
tag supports the following attributes:
name
(mandatory)foreground
color
tags,
or value in hexadecimal format, e.g. "#000000", or symbolic name understood
by Gdk, prefixed with "#", e.g. "#magenta" or "#darkred".
background
italic
bold
underline
PangoUnderline
("none",
"single", "double", "low" or "error"). GtkSourceView versions <= 3.16
only supported "true" or "false" and such values are still accepted for
backward compatibility.
underline-color
strikethrough
scale
"1.75"
) or one of the values
"xx-small"
, "x-small"
, "small"
,
"medium"
, "large"
, "x-large"
,
"xx-large"
. Useful for example to highlight titles or
sub-titles (headings).
The name
attribute of a <style>
tag can have
special values, which control the general appearance:
text
selection
selection-unfocused
cursor
foreground
attribute is used for
this style.
secondary-cursor
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
background
attribute is used.
line-numbers
current-line-number
background
attribute is used.
bracket-match
bracket-mismatch
right-margin
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
foreground
attribute is used.
background-pattern
background
attribute is used.