Blob Blame History Raw
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Style Scheme Definition Reference: GtkSourceView 3 Reference Manual</title>
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot">
<link rel="home" href="index.html" title="GtkSourceView 3 Reference Manual">
<link rel="up" href="pt03.html" title="Part III. Syntax highlighting reference">
<link rel="prev" href="lang-reference.html" title="Language Definition v2.0 Reference">
<link rel="next" href="pt04.html" title="Part IV. Annexes">
<meta name="generator" content="GTK-Doc V1.28.1 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
<td width="100%" align="left" class="shortcuts"></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
<td><a accesskey="u" href="pt03.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
<td><a accesskey="p" href="lang-reference.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
<td><a accesskey="n" href="pt04.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
</tr></table>
<div class="refentry">
<a name="style-reference"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle">Style Scheme Definition Reference</span></h2>
<p>Style Scheme Definition Reference — 
Reference to the GtkSourceView style scheme definition file format
</p>
</td>
<td class="gallery_image" valign="top" align="right"></td>
</tr></table></div>
<div class="refsect1">
<a name="id-1.4.4.3"></a><h2>Overview</h2>
<p>
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 <code class="filename">style.rng</code> which
should be installed on your system in the directory
<code class="filename">${PREFIX}/share/gtksourceview-3.0/</code> (where
<code class="filename">${PREFIX}</code> can be <code class="filename">/usr/</code> or
<code class="filename">/usr/local/</code> if you have installed from source).
</p>
</div>
<p>
The toplevel tag in a style scheme file is <code class="code">&lt;style-scheme&gt;</code>.
It has the following attributes:
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><code class="code">id</code> (mandatory)</span></p></td>
<td><p>
Identifier for the style scheme. This is must be unique among style schemes.
</p></td>
</tr>
<tr>
<td><p><span class="term"><code class="code">name</code> (mandatory)</span></p></td>
<td><p>
Name of the style scheme. This is the name of the scheme to display to user, e.g.
in a preferences dialog.
</p></td>
</tr>
<tr>
<td><p><span class="term"><code class="code">_name</code></span></p></td>
<td><p>
This is the same as <code class="code">name</code> attribute, except it will be translated.
<code class="code">name</code> and <code class="code">_name</code> may not be used simultaneously.
</p></td>
</tr>
<tr>
<td><p><span class="term"><code class="code">parent-scheme</code> (optional)</span></p></td>
<td><p>
Style schemes may have <span class="emphasis"><em>parent</em></span> 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.
</p></td>
</tr>
<tr>
<td><p><span class="term"><code class="code">version</code> (mandatory)</span></p></td>
<td><p>
Style scheme format identifier. At the moment it must be "1.0".
</p></td>
</tr>
</tbody>
</table></div>
<p>
</p>
<p>
<code class="code">style-scheme</code> tag may contain the following tags:
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><code class="code">author</code></span></p></td>
<td><p>
Name of the style scheme author.
</p></td>
</tr>
<tr>
<td><p><span class="term"><code class="code">description</code></span></p></td>
<td><p>
Description of the style scheme.
</p></td>
</tr>
<tr>
<td><p><span class="term"><code class="code">_description</code></span></p></td>
<td><p>
Same as <code class="code">description</code> except it will be localized.
</p></td>
</tr>
<tr>
<td><p><span class="term"><code class="code">color</code> tags</span></p></td>
<td><p>
These define color names to be used in <code class="code">style</code> tags.
It has two attributes: <code class="code">name</code> and <code class="code">value</code>.
<code class="code">value</code> is the hexadecimal color specification like
"#000000" or named color understood by Gdk prefixed with "#",
e.g. "#beige".
</p></td>
</tr>
<tr>
<td><p><span class="term"><code class="code">style</code> tags</span></p></td>
<td><p>
See below for their format description.
</p></td>
</tr>
</tbody>
</table></div>
<p>
</p>
<p>
Each <code class="code">style</code> tag describes a single element of style scheme (it corresponds
to #GtkSourceStyle object). It has the following attributes:
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><code class="code">name</code> (mandatory)</span></p></td>
<td><p>
Name of the style. It can be anything, syntax highlighting uses <span class="emphasis"><em>lang-id:style-id</em></span>,
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.
</p></td>
</tr>
<tr>
<td><p><span class="term"><code class="code">foreground</code></span></p></td>
<td><p>
Foreground color. It may be name defined in one of <code class="code">color</code> tags, or value in
hexadecimal format, e.g. "#000000", or symbolic name understood
by Gdk, prefixed with "#", e.g. "#magenta" or "#darkred".
</p></td>
</tr>
<tr>
<td><p><span class="term"><code class="code">background</code></span></p></td>
<td><p>
Background color.
</p></td>
</tr>
<tr>
<td><p><span class="term"><code class="code">italic</code></span></p></td>
<td><p>"true" or "false"</p></td>
</tr>
<tr>
<td><p><span class="term"><code class="code">bold</code></span></p></td>
<td><p>"true" or "false"</p></td>
</tr>
<tr>
<td><p><span class="term"><code class="code">underline</code></span></p></td>
<td><p>
Accepts the values supported by PangoUnderline ("none", "single",
"double", "low", "error"). GtkSourceView versions &lt;= 3.16 only
supported "true" or "false" and such value are still accepted
for backward compatibility.
</p></td>
</tr>
<tr>
<td><p><span class="term"><code class="code">underline-color</code></span></p></td>
<td><p>
Underline color.
</p></td>
</tr>
<tr>
<td><p><span class="term"><code class="code">strikethrough</code></span></p></td>
<td><p>"true" or "false"</p></td>
</tr>
<tr>
<td><p><span class="term"><code class="code">scale</code></span></p></td>
<td><p>
Scale the matched text block. Possible values are a float number as factor
(e.g. <code class="code">"1.75"</code>) or one of the values <code class="code">"xx-small"</code>,
<code class="code">"x-small"</code>, <code class="code">"small"</code>, <code class="code">"medium"</code>,
<code class="code">"large"</code>,<code class="code">"x-large"</code>,<code class="code">"xx-large"</code>.
</p></td>
</tr>
</tbody>
</table></div>
<p>
</p>
<p>
The following are names of styles which control GtkSourceView appearance:
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><code class="code">text</code></span></p></td>
<td><p>Default style of text.</p></td>
</tr>
<tr>
<td><p><span class="term"><code class="code">selection</code></span></p></td>
<td><p>Style of selected text.</p></td>
</tr>
<tr>
<td><p><span class="term"><code class="code">selection-unfocused</code></span></p></td>
<td><p>Style of selected text when the widget doesn't have input focus.</p></td>
</tr>
<tr>
<td><p><span class="term"><code class="code">cursor</code></span></p></td>
<td><p>Text cursor style. Only the <code class="code">foreground</code> attribute is used
for this style.</p></td>
</tr>
<tr>
<td><p><span class="term"><code class="code">secondary-cursor</code></span></p></td>
<td><p>Secondary cursor style (used in bidirectional text). Only the
<code class="code">foreground</code> 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.</p></td>
</tr>
<tr>
<td><p><span class="term"><code class="code">current-line</code></span></p></td>
<td><p>Current line style. Only the <code class="code">background</code> attribute
is used.</p></td>
</tr>
<tr>
<td><p><span class="term"><code class="code">line-numbers</code></span></p></td>
<td><p>Text and background colors for the left margin, on which line
numbers are drawn.</p></td>
</tr>
<tr>
<td><p><span class="term"><code class="code">current-line-number</code></span></p></td>
<td><p>Current line style for the left margin, on which the current
line number is drawn. Only the <code class="code">background</code> attribute is used.</p></td>
</tr>
<tr>
<td><p><span class="term"><code class="code">bracket-match</code></span></p></td>
<td><p>Style to use for matching brackets.</p></td>
</tr>
<tr>
<td><p><span class="term"><code class="code">bracket-mismatch</code></span></p></td>
<td><p>Style to use for mismatching brackets.</p></td>
</tr>
<tr>
<td><p><span class="term"><code class="code">right-margin</code></span></p></td>
<td><p>Style to use for the right margin. The <code class="code">foreground</code> attribute is used for
drawing the vertical line. And the <code class="code">background</code> 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.</p></td>
</tr>
<tr>
<td><p><span class="term"><code class="code">draw-spaces</code></span></p></td>
<td><p>Style to use for drawing spaces (special symbols for a space, a tabulation, etc).
Only the <code class="code">foreground</code> attribute is used.</p></td>
</tr>
<tr>
<td><p><span class="term"><code class="code">background-pattern</code></span></p></td>
<td><p>Style to use for drawing a background pattern, for example a
grid. Only the <code class="code">background</code> attribute is used.</p></td>
</tr>
</tbody>
</table></div>
<p>
</p>
<div class="refsect1">
<a name="id-1.4.4.8"></a><h2>Default style schemes</h2>
<p>
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.
</p>
</div>
</div>
<div class="footer">
<hr>Generated by GTK-Doc V1.28.1</div>
</body>
</html>