/usr/share/doc/python-pygments/styles.html is in python-pygments 1.6+dfsg-1ubuntu1.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Styles — Pygments</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<style type="text/css">
body {
background-color: #f2f2f2;
margin: 0;
padding: 0;
font-family: 'Georgia', serif;
color: #111;
}
#content {
background-color: white;
padding: 20px;
margin: 20px auto 20px auto;
max-width: 800px;
border: 4px solid #ddd;
}
h1 {
font-weight: normal;
font-size: 40px;
color: #09839A;
}
h2 {
font-weight: normal;
font-size: 30px;
color: #C73F00;
}
h1.heading {
margin: 0 0 30px 0;
}
h2.subheading {
margin: -30px 0 0 45px;
}
h3 {
margin-top: 30px;
}
table.docutils {
border-collapse: collapse;
border: 2px solid #aaa;
margin: 0.5em 1.5em 0.5em 1.5em;
}
table.docutils td {
padding: 2px;
border: 1px solid #ddd;
}
p, li, dd, dt, blockquote {
font-size: 15px;
color: #333;
}
p {
line-height: 150%;
margin-bottom: 0;
margin-top: 10px;
}
hr {
border-top: 1px solid #ccc;
border-bottom: 0;
border-right: 0;
border-left: 0;
margin-bottom: 10px;
margin-top: 20px;
}
dl {
margin-left: 10px;
}
li, dt {
margin-top: 5px;
}
dt {
font-weight: bold;
}
th {
text-align: left;
}
a {
color: #990000;
}
a:hover {
color: #c73f00;
}
pre {
background-color: #f9f9f9;
border-top: 1px solid #ccc;
border-bottom: 1px solid #ccc;
padding: 5px;
font-size: 13px;
font-family: Bitstream Vera Sans Mono,monospace;
}
tt {
font-size: 13px;
font-family: Bitstream Vera Sans Mono,monospace;
color: black;
padding: 1px 2px 1px 2px;
background-color: #f0f0f0;
}
cite {
/* abusing <cite>, it's generated by ReST for `x` */
font-size: 13px;
font-family: Bitstream Vera Sans Mono,monospace;
font-weight: bold;
font-style: normal;
}
#backlink {
float: right;
font-size: 11px;
color: #888;
}
div.toc {
margin: 0 0 10px 0;
}
div.toc h2 {
font-size: 20px;
}
.syntax .hll { background-color: #ffffcc }
.syntax { background: #ffffff; }
.syntax .c { color: #888888 } /* Comment */
.syntax .err { color: #a61717; background-color: #e3d2d2 } /* Error */
.syntax .k { color: #008800; font-weight: bold } /* Keyword */
.syntax .cm { color: #888888 } /* Comment.Multiline */
.syntax .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */
.syntax .c1 { color: #888888 } /* Comment.Single */
.syntax .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */
.syntax .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
.syntax .ge { font-style: italic } /* Generic.Emph */
.syntax .gr { color: #aa0000 } /* Generic.Error */
.syntax .gh { color: #333333 } /* Generic.Heading */
.syntax .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
.syntax .go { color: #888888 } /* Generic.Output */
.syntax .gp { color: #555555 } /* Generic.Prompt */
.syntax .gs { font-weight: bold } /* Generic.Strong */
.syntax .gu { color: #666666 } /* Generic.Subheading */
.syntax .gt { color: #aa0000 } /* Generic.Traceback */
.syntax .kc { color: #008800; font-weight: bold } /* Keyword.Constant */
.syntax .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */
.syntax .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */
.syntax .kp { color: #008800 } /* Keyword.Pseudo */
.syntax .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */
.syntax .kt { color: #888888; font-weight: bold } /* Keyword.Type */
.syntax .m { color: #0000DD; font-weight: bold } /* Literal.Number */
.syntax .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */
.syntax .na { color: #336699 } /* Name.Attribute */
.syntax .nb { color: #003388 } /* Name.Builtin */
.syntax .nc { color: #bb0066; font-weight: bold } /* Name.Class */
.syntax .no { color: #003366; font-weight: bold } /* Name.Constant */
.syntax .nd { color: #555555 } /* Name.Decorator */
.syntax .ne { color: #bb0066; font-weight: bold } /* Name.Exception */
.syntax .nf { color: #0066bb; font-weight: bold } /* Name.Function */
.syntax .nl { color: #336699; font-style: italic } /* Name.Label */
.syntax .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */
.syntax .py { color: #336699; font-weight: bold } /* Name.Property */
.syntax .nt { color: #bb0066; font-weight: bold } /* Name.Tag */
.syntax .nv { color: #336699 } /* Name.Variable */
.syntax .ow { color: #008800 } /* Operator.Word */
.syntax .w { color: #bbbbbb } /* Text.Whitespace */
.syntax .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */
.syntax .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */
.syntax .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */
.syntax .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */
.syntax .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */
.syntax .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */
.syntax .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */
.syntax .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */
.syntax .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */
.syntax .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */
.syntax .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */
.syntax .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */
.syntax .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */
.syntax .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */
.syntax .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */
.syntax .bp { color: #003388 } /* Name.Builtin.Pseudo */
.syntax .vc { color: #336699 } /* Name.Variable.Class */
.syntax .vg { color: #dd7700 } /* Name.Variable.Global */
.syntax .vi { color: #3333bb } /* Name.Variable.Instance */
.syntax .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
</style>
</head>
<body>
<div id="content">
<h1 class="heading">Pygments</h1>
<h2 class="subheading">Styles</h2>
<a id="backlink" href="index.html">« Back To Index</a>
<div class="toc">
<h2>Contents</h2>
<ul class="contents">
<li><a href="#creating-own-styles">Creating Own Styles</a></li>
<li><a href="#style-rules">Style Rules</a></li>
<li><a href="#builtin-styles">Builtin Styles</a></li>
<li><a href="#getting-a-list-of-available-styles">Getting a list of available styles</a></li>
</ul>
</div>
<!-- -*- mode: rst -*- -->
<p>Pygments comes with some builtin styles that work for both the HTML and
LaTeX formatter.</p>
<p>The builtin styles can be looked up with the <cite>get_style_by_name</cite> function:</p>
<div class="syntax"><pre><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">pygments.styles</span> <span class="kn">import</span> <span class="n">get_style_by_name</span>
<span class="gp">>>> </span><span class="n">get_style_by_name</span><span class="p">(</span><span class="s">'colorful'</span><span class="p">)</span>
<span class="go"><class 'pygments.styles.colorful.ColorfulStyle'></span>
</pre></div>
<p>You can pass a instance of a <cite>Style</cite> class to a formatter as the <cite>style</cite>
option in form of a string:</p>
<div class="syntax"><pre><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">pygments.styles</span> <span class="kn">import</span> <span class="n">get_style_by_name</span>
<span class="gp">>>> </span><span class="n">HtmlFormatter</span><span class="p">(</span><span class="n">style</span><span class="o">=</span><span class="s">'colorful'</span><span class="p">)</span><span class="o">.</span><span class="n">style</span>
<span class="go"><class 'pygments.styles.colorful.ColorfulStyle'></span>
</pre></div>
<p>Or you can also import your own style (which must be a subclass of
<cite>pygments.style.Style</cite>) and pass it to the formatter:</p>
<div class="syntax"><pre><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">yourapp.yourmodule</span> <span class="kn">import</span> <span class="n">YourStyle</span>
<span class="gp">>>> </span><span class="n">HtmlFormatter</span><span class="p">(</span><span class="n">style</span><span class="o">=</span><span class="n">YourStyle</span><span class="p">)</span><span class="o">.</span><span class="n">style</span>
<span class="go"><class 'yourapp.yourmodule.YourStyle'></span>
</pre></div>
<div class="section" id="creating-own-styles">
<h3>Creating Own Styles</h3>
<p>So, how to create a style? All you have to do is to subclass <cite>Style</cite> and
define some styles:</p>
<div class="syntax"><pre><span class="kn">from</span> <span class="nn">pygments.style</span> <span class="kn">import</span> <span class="n">Style</span>
<span class="kn">from</span> <span class="nn">pygments.token</span> <span class="kn">import</span> <span class="n">Keyword</span><span class="p">,</span> <span class="n">Name</span><span class="p">,</span> <span class="n">Comment</span><span class="p">,</span> <span class="n">String</span><span class="p">,</span> <span class="n">Error</span><span class="p">,</span> \
<span class="n">Number</span><span class="p">,</span> <span class="n">Operator</span><span class="p">,</span> <span class="n">Generic</span>
<span class="k">class</span> <span class="nc">YourStyle</span><span class="p">(</span><span class="n">Style</span><span class="p">):</span>
<span class="n">default_style</span> <span class="o">=</span> <span class="s">""</span>
<span class="n">styles</span> <span class="o">=</span> <span class="p">{</span>
<span class="n">Comment</span><span class="p">:</span> <span class="s">'italic #888'</span><span class="p">,</span>
<span class="n">Keyword</span><span class="p">:</span> <span class="s">'bold #005'</span><span class="p">,</span>
<span class="n">Name</span><span class="p">:</span> <span class="s">'#f00'</span><span class="p">,</span>
<span class="n">Name</span><span class="o">.</span><span class="n">Function</span><span class="p">:</span> <span class="s">'#0f0'</span><span class="p">,</span>
<span class="n">Name</span><span class="o">.</span><span class="n">Class</span><span class="p">:</span> <span class="s">'bold #0f0'</span><span class="p">,</span>
<span class="n">String</span><span class="p">:</span> <span class="s">'bg:#eee #111'</span>
<span class="p">}</span>
</pre></div>
<p>That's it. There are just a few rules. When you define a style for <cite>Name</cite>
the style automatically also affects <cite>Name.Function</cite> and so on. If you
defined <tt class="docutils literal">'bold'</tt> and you don't want boldface for a subtoken use <tt class="docutils literal">'nobold'</tt>.</p>
<p>(Philosophy: the styles aren't written in CSS syntax since this way
they can be used for a variety of formatters.)</p>
<p><cite>default_style</cite> is the style inherited by all token types.</p>
<p>To make the style usable for Pygments, you must</p>
<ul class="simple">
<li>either register it as a plugin (see <a class="reference external" href="./plugins.html">the plugin docs</a>)</li>
<li>or drop it into the <cite>styles</cite> subpackage of your Pygments distribution one style
class per style, where the file name is the style name and the class name is
<cite>StylenameClass</cite>. For example, if your style should be called
<tt class="docutils literal">"mondrian"</tt>, name the class <cite>MondrianStyle</cite>, put it into the file
<tt class="docutils literal">mondrian.py</tt> and this file into the <tt class="docutils literal">pygments.styles</tt> subpackage
directory.</li>
</ul>
</div>
<div class="section" id="style-rules">
<h3>Style Rules</h3>
<p>Here a small overview of all allowed styles:</p>
<dl class="docutils">
<dt><tt class="docutils literal">bold</tt></dt>
<dd>render text as bold</dd>
<dt><tt class="docutils literal">nobold</tt></dt>
<dd>don't render text as bold (to prevent subtokens being highlighted bold)</dd>
<dt><tt class="docutils literal">italic</tt></dt>
<dd>render text italic</dd>
<dt><tt class="docutils literal">noitalic</tt></dt>
<dd>don't render text as italic</dd>
<dt><tt class="docutils literal">underline</tt></dt>
<dd>render text underlined</dd>
<dt><tt class="docutils literal">nounderline</tt></dt>
<dd>don't render text underlined</dd>
<dt><tt class="docutils literal">bg:</tt></dt>
<dd>transparent background</dd>
<dt><tt class="docutils literal"><span class="pre">bg:#000000</span></tt></dt>
<dd>background color (black)</dd>
<dt><tt class="docutils literal">border:</tt></dt>
<dd>no border</dd>
<dt><tt class="docutils literal"><span class="pre">border:#ffffff</span></tt></dt>
<dd>border color (white)</dd>
<dt><tt class="docutils literal">#ff0000</tt></dt>
<dd>text color (red)</dd>
<dt><tt class="docutils literal">noinherit</tt></dt>
<dd>don't inherit styles from supertoken</dd>
</dl>
<p>Note that there may not be a space between <tt class="docutils literal">bg:</tt> and the color value
since the style definition string is split at whitespace.
Also, using named colors is not allowed since the supported color names
vary for different formatters.</p>
<p>Furthermore, not all lexers might support every style.</p>
</div>
<div class="section" id="builtin-styles">
<h3>Builtin Styles</h3>
<p>Pygments ships some builtin styles which are maintained by the Pygments team.</p>
<p>To get a list of known styles you can use this snippet:</p>
<div class="syntax"><pre><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">pygments.styles</span> <span class="kn">import</span> <span class="n">STYLE_MAP</span>
<span class="gp">>>> </span><span class="n">STYLE_MAP</span><span class="o">.</span><span class="n">keys</span><span class="p">()</span>
<span class="go">['default', 'emacs', 'friendly', 'colorful']</span>
</pre></div>
</div>
<div class="section" id="getting-a-list-of-available-styles">
<h3>Getting a list of available styles</h3>
<p><em>New in Pygments 0.6.</em></p>
<p>Because it could be that a plugin registered a style, there is
a way to iterate over all styles:</p>
<div class="syntax"><pre><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">pygments.styles</span> <span class="kn">import</span> <span class="n">get_all_styles</span>
<span class="gp">>>> </span><span class="n">styles</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span><span class="n">get_all_styles</span><span class="p">())</span>
</pre></div>
</div>
</div>
</body>
<!-- generated on: 2015-12-18 15:41:17.718236
file id: styles -->
</html>
|