jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68:
jpayne@68:[ << ] | jpayne@68:[ >> ] | jpayne@68:jpayne@68: | jpayne@68: | jpayne@68: | jpayne@68: | jpayne@68: | [Top] | jpayne@68:[Contents] | jpayne@68:[Index] | jpayne@68:[ ? ] | jpayne@68:
Text is easier to read when it is accompanied with styling information, jpayne@68: such as color, font attributes (weight, posture), or underlining, and jpayne@68: this styling is customized appropriately for the output device. jpayne@68:
jpayne@68:GNU libtextstyle provides an easy way to add styling to programs that jpayne@68: produce output to a console or terminal emulator window. It does this jpayne@68: in a way that allows the end user to customize the styling using the jpayne@68: industry standard, namely Cascading Style Sheets (CSS). jpayne@68:
jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68:Let's look at the traditional way styling is done for specific programs. jpayne@68:
jpayne@68:Browsers, when they render HTML, use CSS styling. jpayne@68:
jpayne@68:The older approach to user-customizable text styling is that the user jpayne@68: associates patterns with escape sequences in an environment variable or a jpayne@68: command-line argument. This is the approach used, for example, by the jpayne@68: GNU ‘ls’ program in combination with the ‘dircolors’ program. jpayne@68: The processing is distributed across several steps: jpayne@68:
dircolors
program, when invoked, translates such a style
jpayne@68: definition to a sequence of shell statements that sets an environment
jpayne@68: variable LS_COLORS
.
jpayne@68: LS_COLORS
.
jpayne@68: In contrast, this library implements styling as follows: jpayne@68:
<span>
elements for HTML output), and emits it.
jpayne@68: Thus, with GNU libtextstyle, the styling has the following properties: jpayne@68:
There are generally two approaches for adding styling to text: jpayne@68:
The first approach produces a styling that is 100% correct, regardless of jpayne@68: the complexity of the text that is being output. This is the preferred jpayne@68: approach for example for JSON, XML, or programming language text. jpayne@68:
jpayne@68:The second approach works well if the output has a simple, easy-to-parse jpayne@68: format. It may produce wrong styling in some cases when the text format jpayne@68: is more complex. This approach is often used for viewing log files. jpayne@68:
jpayne@68:GNU libtextstyle supports both approaches; it includes an example program jpayne@68: for each of the two approaches. jpayne@68:
jpayne@68: jpayne@68:[ << ] | jpayne@68:[ >> ] | jpayne@68:jpayne@68: | jpayne@68: | jpayne@68: | jpayne@68: | jpayne@68: | [Top] | jpayne@68:[Contents] | jpayne@68:[Index] | jpayne@68:[ ? ] | jpayne@68:
jpayne@68:
jpayne@68: This document was generated by Bruno Haible on February, 21 2024 using texi2html 1.78a.
jpayne@68:
jpayne@68:
jpayne@68:
jpayne@68: