commit 0465f92ea8dc5eeaafb7170e73e339d2d9380c50
parent 412ad586ea524346a3cf0d3d94b18811854f1dec
Author: Byron Torres <b@torresjrjr.com>
Date: Tue, 21 Jun 2022 22:10:06 +0100
docs/haredoc.scd: document $HAREDOC_COLORS
Signed-off-by: Byron Torres <b@torresjrjr.com>
Diffstat:
1 file changed, 44 insertions(+), 0 deletions(-)
diff --git a/docs/haredoc.scd b/docs/haredoc.scd
@@ -53,6 +53,50 @@ present.
export fn example() int;
```
+# TTY COLORS
+
+The TTY output format renders colors in the terminal with ANSI SGR escape
+sequences, behaving similarly to this shell command:
+
+ printf '\\033[0;%sm' '_seq_'
+
+These sequences can be customised with the *HAREDOC_COLORS* environment
+variable, which follows this whitespace-delimited format:
+
+ HAREDOC\_COLORS='_key_=_seq_ _key_=_seq_ _..._'
+
+where each _key_=_seq_ entry assigns a valid _seq_ SGR sequence to a _key_
+syntax category. A valid _seq_ must contain either a single underscore "\_"; or
+digits and/or semicolons ";". Here are the initial default _key_=_seq_ entries.
+
+. normal "0"
+. comment "0"
+. primary "1"
+. secondary "0"
+. keyword "94"
+. type "96"
+. attribute "33"
+. operator "1"
+. punctuation "0"
+. constant "91"
+. string "91"
+. number "95"
+
+Any number of entries can be specified. If a _seq_ is an underscore "\_", the
+sequence specified for "normal" is used. Otherwise, if a _seq_ is invalid,
+blank, empty or absent, its corresponding default sequence is used.
+
+For example:
+
+ HAREDOC\_COLORS='comment=3 primary=1;4 attribute=41' haredoc -Ftty log
+
+# ENVIRONMENT
+
+The following environment variables affect *haredoc*'s execution:
+
+|[ *HAREDOC_COLORS*
+:< Customizes TTY format color rendering. See *TTY COLORS*.
+
# EXAMPLES
Read the documentation for _io_: