jpayne@68
|
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html401/loose.dtd">
|
jpayne@68
|
2 <html>
|
jpayne@68
|
3 <!-- Created on February, 21 2024 by texi2html 1.78a -->
|
jpayne@68
|
4 <!--
|
jpayne@68
|
5 Written by: Lionel Cons <Lionel.Cons@cern.ch> (original author)
|
jpayne@68
|
6 Karl Berry <karl@freefriends.org>
|
jpayne@68
|
7 Olaf Bachmann <obachman@mathematik.uni-kl.de>
|
jpayne@68
|
8 and many others.
|
jpayne@68
|
9 Maintained by: Many creative people.
|
jpayne@68
|
10 Send bugs and suggestions to <texi2html-bug@nongnu.org>
|
jpayne@68
|
11
|
jpayne@68
|
12 -->
|
jpayne@68
|
13 <head>
|
jpayne@68
|
14 <title>GNU libtextstyle: 2. The end user's perspective</title>
|
jpayne@68
|
15
|
jpayne@68
|
16 <meta name="description" content="GNU libtextstyle: 2. The end user's perspective">
|
jpayne@68
|
17 <meta name="keywords" content="GNU libtextstyle: 2. The end user's perspective">
|
jpayne@68
|
18 <meta name="resource-type" content="document">
|
jpayne@68
|
19 <meta name="distribution" content="global">
|
jpayne@68
|
20 <meta name="Generator" content="texi2html 1.78a">
|
jpayne@68
|
21 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
jpayne@68
|
22 <style type="text/css">
|
jpayne@68
|
23 <!--
|
jpayne@68
|
24 a.summary-letter {text-decoration: none}
|
jpayne@68
|
25 pre.display {font-family: serif}
|
jpayne@68
|
26 pre.format {font-family: serif}
|
jpayne@68
|
27 pre.menu-comment {font-family: serif}
|
jpayne@68
|
28 pre.menu-preformatted {font-family: serif}
|
jpayne@68
|
29 pre.smalldisplay {font-family: serif; font-size: smaller}
|
jpayne@68
|
30 pre.smallexample {font-size: smaller}
|
jpayne@68
|
31 pre.smallformat {font-family: serif; font-size: smaller}
|
jpayne@68
|
32 pre.smalllisp {font-size: smaller}
|
jpayne@68
|
33 span.roman {font-family:serif; font-weight:normal;}
|
jpayne@68
|
34 span.sansserif {font-family:sans-serif; font-weight:normal;}
|
jpayne@68
|
35 ul.toc {list-style: none}
|
jpayne@68
|
36 -->
|
jpayne@68
|
37 </style>
|
jpayne@68
|
38
|
jpayne@68
|
39
|
jpayne@68
|
40 </head>
|
jpayne@68
|
41
|
jpayne@68
|
42 <body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
|
jpayne@68
|
43
|
jpayne@68
|
44 <table cellpadding="1" cellspacing="1" border="0">
|
jpayne@68
|
45 <tr><td valign="middle" align="left">[<a href="libtextstyle_1.html#SEC1" title="Beginning of this chapter or previous chapter"> << </a>]</td>
|
jpayne@68
|
46 <td valign="middle" align="left">[<a href="libtextstyle_3.html#SEC15" title="Next chapter"> >> </a>]</td>
|
jpayne@68
|
47 <td valign="middle" align="left"> </td>
|
jpayne@68
|
48 <td valign="middle" align="left"> </td>
|
jpayne@68
|
49 <td valign="middle" align="left"> </td>
|
jpayne@68
|
50 <td valign="middle" align="left"> </td>
|
jpayne@68
|
51 <td valign="middle" align="left"> </td>
|
jpayne@68
|
52 <td valign="middle" align="left">[<a href="libtextstyle_toc.html#SEC_Top" title="Cover (top) of document">Top</a>]</td>
|
jpayne@68
|
53 <td valign="middle" align="left">[<a href="libtextstyle_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
|
jpayne@68
|
54 <td valign="middle" align="left">[<a href="libtextstyle_5.html#SEC46" title="Index">Index</a>]</td>
|
jpayne@68
|
55 <td valign="middle" align="left">[<a href="libtextstyle_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
|
jpayne@68
|
56 </tr></table>
|
jpayne@68
|
57
|
jpayne@68
|
58 <hr size="2">
|
jpayne@68
|
59 <a name="The-user_0027s-view"></a>
|
jpayne@68
|
60 <a name="SEC4"></a>
|
jpayne@68
|
61 <h1 class="chapter"> <a href="libtextstyle_toc.html#TOC4">2. The end user's perspective</a> </h1>
|
jpayne@68
|
62
|
jpayne@68
|
63 <p>Styled output can viewed fine in a console or terminal emulator window.
|
jpayne@68
|
64 </p>
|
jpayne@68
|
65 <p>The stylable program will typically have the following options:
|
jpayne@68
|
66 </p><dl compact="compact">
|
jpayne@68
|
67 <dt> <code>--color</code></dt>
|
jpayne@68
|
68 <dd><p>Use colors and other text attributes always.
|
jpayne@68
|
69 </p></dd>
|
jpayne@68
|
70 <dt> <code>--color=<var>when</var></code></dt>
|
jpayne@68
|
71 <dd><p>Use colors and other text attributes if <var>when</var>. <var>when</var> may be
|
jpayne@68
|
72 <code>always</code>, <code>never</code>, <code>auto</code>, or <code>html</code>.
|
jpayne@68
|
73 </p></dd>
|
jpayne@68
|
74 <dt> <code>--style=<var>style-file</var></code></dt>
|
jpayne@68
|
75 <dd><p>Specify the CSS style rule file for <code>--color</code>.
|
jpayne@68
|
76 </p></dd>
|
jpayne@68
|
77 </dl>
|
jpayne@68
|
78
|
jpayne@68
|
79 <p>For more details, see the sections <a href="#SEC11">The <code>--color</code> option</a> and
|
jpayne@68
|
80 <a href="#SEC12">The <code>--style</code> option</a> below.
|
jpayne@68
|
81 </p>
|
jpayne@68
|
82 <p>If the output does not fit on a screen, you can use ‘<samp>less -R</samp>’ to
|
jpayne@68
|
83 scroll around in the styled output. For example:
|
jpayne@68
|
84 </p><table><tr><td> </td><td><pre class="smallexample"><var>program</var> --color <var>arguments</var> | less -R
|
jpayne@68
|
85 </pre></td></tr></table>
|
jpayne@68
|
86
|
jpayne@68
|
87
|
jpayne@68
|
88
|
jpayne@68
|
89 <a name="The-TERM-variable"></a>
|
jpayne@68
|
90 <a name="SEC5"></a>
|
jpayne@68
|
91 <h2 class="section"> <a href="libtextstyle_toc.html#TOC5">2.1 The environment variable <code>TERM</code></a> </h2>
|
jpayne@68
|
92
|
jpayne@68
|
93 <p>The environment variable <code>TERM</code> contains a identifier for the text
|
jpayne@68
|
94 window's capabilities. You can get a detailed list of these cababilities
|
jpayne@68
|
95 by using the ‘<samp>infocmp</samp>’ command (for example: <code>infocmp -L1 xterm</code>),
|
jpayne@68
|
96 using ‘<samp>man 5 terminfo</samp>’ as a reference.
|
jpayne@68
|
97 </p>
|
jpayne@68
|
98 <p>When producing text with embedded color directives, a
|
jpayne@68
|
99 <code>libtextstyle</code>-enabled program looks at the <code>TERM</code> variable.
|
jpayne@68
|
100 Text windows today typically support at least 8 colors. Often, however,
|
jpayne@68
|
101 the text window supports 16 or more colors, even though the <code>TERM</code>
|
jpayne@68
|
102 variable is set to a identifier denoting only 8 supported colors. It
|
jpayne@68
|
103 can be worth setting the <code>TERM</code> variable to a different value in
|
jpayne@68
|
104 these cases.
|
jpayne@68
|
105 </p>
|
jpayne@68
|
106 <p>After setting <code>TERM</code>, you can verify how well it works by invoking
|
jpayne@68
|
107 ‘<samp><var>program</var> --color=test</samp>’, where <code><var>program</var></code> is any
|
jpayne@68
|
108 <code>libtextstyle</code>-enabled program, and seeing whether the output looks
|
jpayne@68
|
109 like a reasonable color map.
|
jpayne@68
|
110 </p>
|
jpayne@68
|
111
|
jpayne@68
|
112
|
jpayne@68
|
113 <a name="Terminal-emulators"></a>
|
jpayne@68
|
114 <a name="SEC6"></a>
|
jpayne@68
|
115 <h3 class="subsection"> <a href="libtextstyle_toc.html#TOC6">2.1.1 Terminal emulator programs</a> </h3>
|
jpayne@68
|
116
|
jpayne@68
|
117 <p>The following terminal emulator programs support 256 colors and set
|
jpayne@68
|
118 <code>TERM=xterm-256color</code> accordingly:
|
jpayne@68
|
119 </p>
|
jpayne@68
|
120 <ul>
|
jpayne@68
|
121 <li>
|
jpayne@68
|
122 In GNOME: <code>gnome-terminal</code>, <code>tilda</code>.
|
jpayne@68
|
123 </li><li>
|
jpayne@68
|
124 <code>rxvt-unicode</code> (sets <code>TERM=rxvt-unicode-256color</code>).
|
jpayne@68
|
125 </li><li>
|
jpayne@68
|
126 <code>st</code> (sets <code>TERM=st-256color</code>).
|
jpayne@68
|
127 </li><li>
|
jpayne@68
|
128 <code>QTerminal</code>.
|
jpayne@68
|
129 </li><li>
|
jpayne@68
|
130 On macOS: <code>Terminal</code>, <code>iTerm2</code>.
|
jpayne@68
|
131 </li></ul>
|
jpayne@68
|
132
|
jpayne@68
|
133 <p>The following terminal emulator programs support 256 colors. You only
|
jpayne@68
|
134 need to set <code>TERM=xterm-256color</code> or similar; the programs by default
|
jpayne@68
|
135 set <code>TERM</code> to a value that supports only 8 colors.
|
jpayne@68
|
136 </p>
|
jpayne@68
|
137 <ul>
|
jpayne@68
|
138 <li>
|
jpayne@68
|
139 <code>xterm</code> is in many cases built with support for 256 colors. But it
|
jpayne@68
|
140 sets <code>TERM=xterm</code>. You need to set <code>TERM=xterm-256color</code>.
|
jpayne@68
|
141 </li><li>
|
jpayne@68
|
142 In GNOME: <code>guake</code> (sets <code>TERM=xterm</code>). You need to set
|
jpayne@68
|
143 <code>TERM=xterm-256color</code>.
|
jpayne@68
|
144 </li><li>
|
jpayne@68
|
145 In KDE: <code>konsole</code> (sets <code>TERM=xterm</code>). You need to set
|
jpayne@68
|
146 <code>TERM=xterm-256color</code> or <code>TERM=konsole-256color</code>.
|
jpayne@68
|
147 </li><li>
|
jpayne@68
|
148 In KDE: <code>yakuake</code> (sets <code>TERM=xterm</code>). You need to set
|
jpayne@68
|
149 <code>TERM=xterm-256color</code>.
|
jpayne@68
|
150 </li><li>
|
jpayne@68
|
151 In Enlightenment: <code>Eterm</code> (sets <code>TERM=Eterm</code>). You need to set
|
jpayne@68
|
152 <code>TERM=Eterm-256color</code>.
|
jpayne@68
|
153 </li><li>
|
jpayne@68
|
154 <code>mlterm</code> (sets <code>TERM=mlterm</code>). You need to set
|
jpayne@68
|
155 <code>TERM=mlterm-256color</code>.
|
jpayne@68
|
156 </li><li>
|
jpayne@68
|
157 On Windows: <code>PuTTY</code> (sets <code>TERM=xterm</code>). You need to set
|
jpayne@68
|
158 <code>TERM=xterm-256color</code> or <code>TERM=putty-256color</code>.
|
jpayne@68
|
159 </li><li>
|
jpayne@68
|
160 On Windows: <code>TeraTerm</code> (sets <code>TERM=xterm</code>). You need to set
|
jpayne@68
|
161 <code>TERM=xterm-256color</code>.
|
jpayne@68
|
162 </li></ul>
|
jpayne@68
|
163
|
jpayne@68
|
164 <p>A couple of terminal emulator programs support even the entire RGB color
|
jpayne@68
|
165 space (16 million colors). To get this to work, at this date (2019), you
|
jpayne@68
|
166 need three things:
|
jpayne@68
|
167 </p><ul>
|
jpayne@68
|
168 <li>
|
jpayne@68
|
169 The <code>ncurses</code> library version 6.1 or newer must be installed.
|
jpayne@68
|
170 </li><li>
|
jpayne@68
|
171 You need a recent version of the respective terminal emulator program.
|
jpayne@68
|
172 See <a href="https://gist.github.com/XVilka/8346728">https://gist.github.com/XVilka/8346728</a> for the most recent
|
jpayne@68
|
173 developments in this area.
|
jpayne@68
|
174 </li><li>
|
jpayne@68
|
175 You need to set the <code>TERM</code> environment variable to the corresponding
|
jpayne@68
|
176 value:
|
jpayne@68
|
177 <code>TERM=xterm-direct</code> instead of
|
jpayne@68
|
178 <code>TERM=xterm</code> or <code>TERM=xterm-256color</code>,
|
jpayne@68
|
179 <code>TERM=konsole-direct</code> in <code>konsole</code>,
|
jpayne@68
|
180 <code>TERM=st-direct</code> in <code>st</code>,
|
jpayne@68
|
181 <code>TERM=mlterm-direct</code> in <code>mlterm</code>,
|
jpayne@68
|
182 or <code>TERM=iterm2-direct</code> in <code>iTerm2</code> on macOS.
|
jpayne@68
|
183 </li></ul>
|
jpayne@68
|
184
|
jpayne@68
|
185
|
jpayne@68
|
186 <a name="Consoles"></a>
|
jpayne@68
|
187 <a name="SEC7"></a>
|
jpayne@68
|
188 <h3 class="subsection"> <a href="libtextstyle_toc.html#TOC7">2.1.2 Consoles</a> </h3>
|
jpayne@68
|
189
|
jpayne@68
|
190 <p>On OpenBSD 6 consoles, <code>TERM=xterm</code> produces better results than the
|
jpayne@68
|
191 default <code>TERM=vt220</code>.
|
jpayne@68
|
192 </p>
|
jpayne@68
|
193 <p>On NetBSD 8 consoles, <code>TERM=netbsd6</code> produces better results than the
|
jpayne@68
|
194 default <code>TERM=vt100</code>.
|
jpayne@68
|
195 </p>
|
jpayne@68
|
196 <p>On Windows consoles, no <code>TERM</code> setting is needed.
|
jpayne@68
|
197 </p>
|
jpayne@68
|
198
|
jpayne@68
|
199 <a name="The-NO_005fCOLOR-variable"></a>
|
jpayne@68
|
200 <a name="SEC8"></a>
|
jpayne@68
|
201 <h2 class="section"> <a href="libtextstyle_toc.html#TOC8">2.2 The environment variable <code>NO_COLOR</code></a> </h2>
|
jpayne@68
|
202
|
jpayne@68
|
203 <p>The environment variable <code>NO_COLOR</code> can be used to suppress styling
|
jpayne@68
|
204 in the textual output. When this environment variable is set (to any value),
|
jpayne@68
|
205 <code>libtextstyle</code>-enabled programs will not emit colors and other text
|
jpayne@68
|
206 styling.
|
jpayne@68
|
207 </p>
|
jpayne@68
|
208 <p>This environment variable can be overridden by passing the command-line option
|
jpayne@68
|
209 ‘<samp>--color=always</samp>’ (see <a href="#SEC11">The <code>--color</code> option</a>).
|
jpayne@68
|
210 </p>
|
jpayne@68
|
211
|
jpayne@68
|
212 <a name="The-NO_005fTERM_005fHYPERLINKS-variable"></a>
|
jpayne@68
|
213 <a name="SEC9"></a>
|
jpayne@68
|
214 <h2 class="section"> <a href="libtextstyle_toc.html#TOC9">2.3 The environment variable <code>NO_TERM_HYPERLINKS</code></a> </h2>
|
jpayne@68
|
215
|
jpayne@68
|
216 <p>The environment variable <code>NO_TERM_HYPERLINKS</code> can be used to suppress
|
jpayne@68
|
217 hyperlinks in the textual output. When this environment variable is set
|
jpayne@68
|
218 (to any value), <code>libtextstyle</code>-enabled programs will not emit
|
jpayne@68
|
219 hyperlinks. This may be useful for terminal emulators which produce
|
jpayne@68
|
220 garbage output when they receive the escape sequence for a hyperlink.
|
jpayne@68
|
221 Currently (as of 2019), this affects some versions of
|
jpayne@68
|
222 <code>konsole</code>, <code>emacs</code>, <code>lxterminal</code>, <code>guake</code>, <code>yakuake</code>, <code>rxvt</code>. </p>
|
jpayne@68
|
223
|
jpayne@68
|
224 <a name="Emacs"></a>
|
jpayne@68
|
225 <a name="SEC10"></a>
|
jpayne@68
|
226 <h2 class="section"> <a href="libtextstyle_toc.html#TOC10">2.4 Emacs as a terminal emulator</a> </h2>
|
jpayne@68
|
227
|
jpayne@68
|
228 <p>Emacs has several terminal emulators: <code>M-x shell</code> and
|
jpayne@68
|
229 <code>M-x term</code>. <code>M-x term</code> has good support for styling, whereas
|
jpayne@68
|
230 in <code>M-x shell</code> most of the styling gets lost.
|
jpayne@68
|
231 </p>
|
jpayne@68
|
232
|
jpayne@68
|
233 <a name="The-_002d_002dcolor-option"></a>
|
jpayne@68
|
234 <a name="SEC11"></a>
|
jpayne@68
|
235 <h2 class="section"> <a href="libtextstyle_toc.html#TOC11">2.5 The <code>--color</code> option</a> </h2>
|
jpayne@68
|
236
|
jpayne@68
|
237 <p>The ‘<samp>--color=<var>when</var></samp>’ option specifies under which conditions
|
jpayne@68
|
238 styled (colorized) output should be generated. The <var>when</var> part can
|
jpayne@68
|
239 be one of the following:
|
jpayne@68
|
240 </p>
|
jpayne@68
|
241 <dl compact="compact">
|
jpayne@68
|
242 <dt> <code>always</code></dt>
|
jpayne@68
|
243 <dt> <code>yes</code></dt>
|
jpayne@68
|
244 <dd><p>The output will be colorized.
|
jpayne@68
|
245 </p>
|
jpayne@68
|
246 </dd>
|
jpayne@68
|
247 <dt> <code>never</code></dt>
|
jpayne@68
|
248 <dt> <code>no</code></dt>
|
jpayne@68
|
249 <dd><p>The output will not be colorized.
|
jpayne@68
|
250 </p>
|
jpayne@68
|
251 </dd>
|
jpayne@68
|
252 <dt> <code>auto</code></dt>
|
jpayne@68
|
253 <dt> <code>tty</code></dt>
|
jpayne@68
|
254 <dd><p>The output will be colorized if the output device is a tty, i.e. when
|
jpayne@68
|
255 the output goes directly to a text screen or terminal emulator window.
|
jpayne@68
|
256 </p>
|
jpayne@68
|
257 </dd>
|
jpayne@68
|
258 <dt> <code>html</code></dt>
|
jpayne@68
|
259 <dd><p>The output will be colorized and be in HTML format. This value is only
|
jpayne@68
|
260 supported by some programs.
|
jpayne@68
|
261 </p>
|
jpayne@68
|
262 </dd>
|
jpayne@68
|
263 <dt> <code>test</code></dt>
|
jpayne@68
|
264 <dd><p>This is a special value, understood only by some programs. It is
|
jpayne@68
|
265 explained in the section (<a href="#SEC5">The environment variable <code>TERM</code></a>) above.
|
jpayne@68
|
266 </p></dd>
|
jpayne@68
|
267 </dl>
|
jpayne@68
|
268
|
jpayne@68
|
269 <p>‘<samp>--color</samp>’ is equivalent to ‘<samp>--color=yes</samp>’. The default is
|
jpayne@68
|
270 ‘<samp>--color=auto</samp>’.
|
jpayne@68
|
271 </p>
|
jpayne@68
|
272 <p>Thus, a command that invokes a <code>libtextstyle</code>-enabled program will
|
jpayne@68
|
273 produce colorized output when called by itself in a command window.
|
jpayne@68
|
274 Whereas in a pipe, such as ‘<samp><var>program</var> <var>arguments</var> | less -R</samp>’,
|
jpayne@68
|
275 it will not produce colorized output. To get colorized output in this
|
jpayne@68
|
276 situation nevertheless, use the command
|
jpayne@68
|
277 ‘<samp><var>program</var> --color <var>arguments</var> | less -R</samp>’.
|
jpayne@68
|
278 </p>
|
jpayne@68
|
279 <p>The ‘<samp>--color=html</samp>’ option will produce output that can be viewed in
|
jpayne@68
|
280 a browser. This can be useful, for example, for Indic languages,
|
jpayne@68
|
281 because the renderic of Indic scripts in browsers is usually better than
|
jpayne@68
|
282 in terminal emulators.
|
jpayne@68
|
283 </p>
|
jpayne@68
|
284 <p>Note that the output produced with the <code>--color</code> option is
|
jpayne@68
|
285 <em>not</em> consumable by programs that expect the raw text. It contains
|
jpayne@68
|
286 additional terminal-specific escape sequences or HTML tags. For example,
|
jpayne@68
|
287 an XML parser will give a syntax error when confronted with a colored XML
|
jpayne@68
|
288 output. Except for the ‘<samp>--color=html</samp>’ case, you therefore normally
|
jpayne@68
|
289 don't need to save output produced with the <code>--color</code> option in a
|
jpayne@68
|
290 file.
|
jpayne@68
|
291 </p>
|
jpayne@68
|
292
|
jpayne@68
|
293 <a name="The-_002d_002dstyle-option"></a>
|
jpayne@68
|
294 <a name="SEC12"></a>
|
jpayne@68
|
295 <h2 class="section"> <a href="libtextstyle_toc.html#TOC12">2.6 The <code>--style</code> option</a> </h2>
|
jpayne@68
|
296
|
jpayne@68
|
297 <p>The ‘<samp>--style=<var>style_file</var></samp>’ option specifies the style file to
|
jpayne@68
|
298 use when colorizing. It has an effect only when the <code>--color</code>
|
jpayne@68
|
299 option is effective.
|
jpayne@68
|
300 </p>
|
jpayne@68
|
301 <p>If the <code>--style</code> option is not specified, the program may consider
|
jpayne@68
|
302 the value of an environment variable. It is meant to point to the user's
|
jpayne@68
|
303 preferred style for such output. The name of such an environment
|
jpayne@68
|
304 variable, if supported, is documented in the documentation of the
|
jpayne@68
|
305 <code>libtextstyle</code>-enabled program.
|
jpayne@68
|
306 </p>
|
jpayne@68
|
307 <p>You can also design your own styles. This is described in the next
|
jpayne@68
|
308 section.
|
jpayne@68
|
309 </p>
|
jpayne@68
|
310
|
jpayne@68
|
311
|
jpayne@68
|
312 <a name="Style-rules"></a>
|
jpayne@68
|
313 <a name="SEC13"></a>
|
jpayne@68
|
314 <h3 class="subsection"> <a href="libtextstyle_toc.html#TOC13">2.6.1 Creating your own style files</a> </h3>
|
jpayne@68
|
315
|
jpayne@68
|
316 <p>The same style file can be used for styling a certain type of output, for
|
jpayne@68
|
317 terminal output and for HTML output. It is written in CSS
|
jpayne@68
|
318 (Cascading Style Sheet) syntax. See
|
jpayne@68
|
319 <a href="https://www.w3.org/TR/css2/cover.html">https://www.w3.org/TR/css2/cover.html</a> for a formal definition of
|
jpayne@68
|
320 CSS. Many HTML authoring tutorials also contain explanations of CSS.
|
jpayne@68
|
321 </p>
|
jpayne@68
|
322 <p>In the case of HTML output, the style file is embedded in the HTML output.
|
jpayne@68
|
323 In the case of text output, the style file is interpreted by the
|
jpayne@68
|
324 <code>libtextstyle</code>-enabled program.
|
jpayne@68
|
325 </p>
|
jpayne@68
|
326 <p>You should avoid <code>@import</code> statements, because
|
jpayne@68
|
327 </p><ul class="toc">
|
jpayne@68
|
328 <li>-
|
jpayne@68
|
329 In the case of HTML output, the files referenced by the <code>@import</code>
|
jpayne@68
|
330 statements would not be embedded in the HTML output. In fact, relative
|
jpayne@68
|
331 file names would be interpreted relative to the resulting HTML file.
|
jpayne@68
|
332 </li><li>-
|
jpayne@68
|
333 In the case of text output, <code>@import</code>s are not supported, due to a
|
jpayne@68
|
334 limitation in <code>libcroco</code>.
|
jpayne@68
|
335 </li></ul>
|
jpayne@68
|
336
|
jpayne@68
|
337 <p>CSS rules are built up from selectors and declarations. The declarations
|
jpayne@68
|
338 specify graphical properties; the selectors specify when they apply.
|
jpayne@68
|
339 </p>
|
jpayne@68
|
340 <p>GNU libtextstyle supports simple selectors based on "CSS classes", see
|
jpayne@68
|
341 the CSS2 spec, section 5.8.3. The set of CSS classes that are supported
|
jpayne@68
|
342 by a <code>libtextstyle</code>-enabled program are documented in the
|
jpayne@68
|
343 documentation of that program.
|
jpayne@68
|
344 </p>
|
jpayne@68
|
345 <p>These selectors can be combined to hierarchical selectors. For example,
|
jpayne@68
|
346 assume a program supports the CSS classes <code>string</code> (that matches a
|
jpayne@68
|
347 string) and <code>non-ascii</code> (that matches a word with non-ASCII
|
jpayne@68
|
348 characters), you could write
|
jpayne@68
|
349 </p>
|
jpayne@68
|
350 <table><tr><td> </td><td><pre class="smallexample">.string .non-ascii { color: red; }
|
jpayne@68
|
351 </pre></td></tr></table>
|
jpayne@68
|
352
|
jpayne@68
|
353 <p>to highlight only the non-ASCII words inside strings.
|
jpayne@68
|
354 </p>
|
jpayne@68
|
355 <p>In text mode, pseudo-classes (CSS2 spec, section 5.11) and
|
jpayne@68
|
356 pseudo-elements (CSS2 spec, section 5.12) are not supported.
|
jpayne@68
|
357 </p>
|
jpayne@68
|
358 <p>The declarations in HTML mode are not limited; any graphical attribute
|
jpayne@68
|
359 supported by the browsers can be used.
|
jpayne@68
|
360 </p>
|
jpayne@68
|
361 <p>The declarations in text mode are limited to the following properties.
|
jpayne@68
|
362 Other properties will be silently ignored.
|
jpayne@68
|
363 </p>
|
jpayne@68
|
364 <dl compact="compact">
|
jpayne@68
|
365 <dt> <code>color</code> (CSS2 spec, section 14.1)</dt>
|
jpayne@68
|
366 <dt> <code>background-color</code> (CSS2 spec, section 14.2.1)</dt>
|
jpayne@68
|
367 <dd><p>These properties are supported. Colors will be adjusted to match the
|
jpayne@68
|
368 terminal's capabilities. Note that many terminals support only 8 colors.
|
jpayne@68
|
369 </p>
|
jpayne@68
|
370 </dd>
|
jpayne@68
|
371 <dt> <code>font-weight</code> (CSS2 spec, section 15.2.3)</dt>
|
jpayne@68
|
372 <dd><p>This property is supported, but most terminals can only render two
|
jpayne@68
|
373 different weights: <code>normal</code> and <code>bold</code>. Values >= 600 are
|
jpayne@68
|
374 rendered as <code>bold</code>.
|
jpayne@68
|
375 </p>
|
jpayne@68
|
376 </dd>
|
jpayne@68
|
377 <dt> <code>font-style</code> (CSS2 spec, section 15.2.3)</dt>
|
jpayne@68
|
378 <dd><p>This property is supported. The values <code>italic</code> and <code>oblique</code>
|
jpayne@68
|
379 are rendered the same way.
|
jpayne@68
|
380 </p>
|
jpayne@68
|
381 </dd>
|
jpayne@68
|
382 <dt> <code>text-decoration</code> (CSS2 spec, section 16.3.1)</dt>
|
jpayne@68
|
383 <dd><p>This property is supported, limited to the values <code>none</code> and
|
jpayne@68
|
384 <code>underline</code>.
|
jpayne@68
|
385 </p></dd>
|
jpayne@68
|
386 </dl>
|
jpayne@68
|
387
|
jpayne@68
|
388
|
jpayne@68
|
389 <a name="Debugging-style-files"></a>
|
jpayne@68
|
390 <a name="SEC14"></a>
|
jpayne@68
|
391 <h3 class="subsection"> <a href="libtextstyle_toc.html#TOC14">2.6.2 Debugging style files</a> </h3>
|
jpayne@68
|
392
|
jpayne@68
|
393 <p>If you want to understand why the style rules in a style file produce
|
jpayne@68
|
394 the output that you see, you can do so in three steps:
|
jpayne@68
|
395 </p>
|
jpayne@68
|
396 <ol>
|
jpayne@68
|
397 <li>
|
jpayne@68
|
398 Run the program with the command-line option <code>--color=html</code>,
|
jpayne@68
|
399 redirecting the output to a file.
|
jpayne@68
|
400 </li><li>
|
jpayne@68
|
401 Open the resulting HTML file in a browser.
|
jpayne@68
|
402 </li><li>
|
jpayne@68
|
403 Use the browser's built-in CSS debugging tool.
|
jpayne@68
|
404 <ul>
|
jpayne@68
|
405 <li>
|
jpayne@68
|
406 In Firefox: From the pop-up menu, select "Inspect Element".
|
jpayne@68
|
407 Click somewhere in the DOM tree ("Inspector" tab) and look at the
|
jpayne@68
|
408 CSS declarations in the "Rules" tab.
|
jpayne@68
|
409 </li><li>
|
jpayne@68
|
410 In Chromium: From the pop-up menu, select "Inspect".
|
jpayne@68
|
411 Click somewhere in the DOM tree ("Elements" tab) and look at the
|
jpayne@68
|
412 CSS declarations in the "Styles" tab.
|
jpayne@68
|
413 </li></ul>
|
jpayne@68
|
414 </li></ol>
|
jpayne@68
|
415
|
jpayne@68
|
416 <p>This technique allows you, in particular, to see which CSS declarations
|
jpayne@68
|
417 override which other CSS declarations from other CSS rules.
|
jpayne@68
|
418 </p>
|
jpayne@68
|
419
|
jpayne@68
|
420 <table cellpadding="1" cellspacing="1" border="0">
|
jpayne@68
|
421 <tr><td valign="middle" align="left">[<a href="#SEC4" title="Beginning of this chapter or previous chapter"> << </a>]</td>
|
jpayne@68
|
422 <td valign="middle" align="left">[<a href="libtextstyle_3.html#SEC15" title="Next chapter"> >> </a>]</td>
|
jpayne@68
|
423 <td valign="middle" align="left"> </td>
|
jpayne@68
|
424 <td valign="middle" align="left"> </td>
|
jpayne@68
|
425 <td valign="middle" align="left"> </td>
|
jpayne@68
|
426 <td valign="middle" align="left"> </td>
|
jpayne@68
|
427 <td valign="middle" align="left"> </td>
|
jpayne@68
|
428 <td valign="middle" align="left">[<a href="libtextstyle_toc.html#SEC_Top" title="Cover (top) of document">Top</a>]</td>
|
jpayne@68
|
429 <td valign="middle" align="left">[<a href="libtextstyle_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
|
jpayne@68
|
430 <td valign="middle" align="left">[<a href="libtextstyle_5.html#SEC46" title="Index">Index</a>]</td>
|
jpayne@68
|
431 <td valign="middle" align="left">[<a href="libtextstyle_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
|
jpayne@68
|
432 </tr></table>
|
jpayne@68
|
433 <p>
|
jpayne@68
|
434 <font size="-1">
|
jpayne@68
|
435 This document was generated by <em>Bruno Haible</em> on <em>February, 21 2024</em> using <a href="https://www.nongnu.org/texi2html/"><em>texi2html 1.78a</em></a>.
|
jpayne@68
|
436 </font>
|
jpayne@68
|
437 <br>
|
jpayne@68
|
438
|
jpayne@68
|
439 </p>
|
jpayne@68
|
440 </body>
|
jpayne@68
|
441 </html>
|