about summary refs log tree commit diff stats
path: root/doc
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-02-17 19:28:40 +0100
committerbptato <nincsnevem662@gmail.com>2024-02-17 19:28:40 +0100
commite98d0ad1dc51050eb17120f835847d55950c2a0b (patch)
treedfe6848c19bffbad3f24159aa6fe0af0355c6048 /doc
parent89d1bdc04343dac1d09282424f4b8538f1db5ad3 (diff)
downloadchawan-e98d0ad1dc51050eb17120f835847d55950c2a0b.tar.gz
term: fix coloring mess
Until now, the config file required manual adjustment for the output to
look bearable on terminals colored differently than {bgcolor: black,
fgcolor: white}. Also, it only detected RGB when COLORTERM was set, but
this is not done by most (any?) terminal emulators (sad).

To improve upon the situation, we now query the terminal for some
attributes on startup:

* OSC(10/11, ?) -> get the terminal's bg/fgcolor
* DCS(+, q, 524742) -> XTGETTCAP for the "RGB" capability (only
  supported by a few terminals, but better than nothing)
* Primary device attributes -> check if ANSI colors are supported, also
  make sure we don't block indefinitely even if the previous queries
  fail

If primary device attributes does not return anything, we hang until
the user types something, then notify the user that something went
wrong, and tell them how to fix it. Seems like an OK fallback.

(The DA1 idea comes from notcurses; since this is implemented by pretty
much every terminal emulator, we don't have to rely on slow timing hacks
to skip non-supported queries.)
Diffstat (limited to 'doc')
-rw-r--r--doc/config.md20
1 files changed, 16 insertions, 4 deletions
diff --git a/doc/config.md b/doc/config.md
index 8ecf54a4..361323ee 100644
--- a/doc/config.md
+++ b/doc/config.md
@@ -398,14 +398,26 @@ black background, etc).</td>
 
 <tr>
 <td>default-background-color</td>
-<td>color</td>
-<td>Sets the assumed background color of the terminal.</td>
+<td>"auto" / color</td>
+<td>Overrides the assumed background color of the terminal. "auto" leaves
+background color detection to Chawan.</td>
 </tr>
 
 <tr>
 <td>default-foreground-color</td>
-<td>color</td>
-<td>Sets the assumed foreground color of the terminal.</td>
+<td>"auto" / color</td>
+<td>Sets the assumed foreground color of the terminal. "auto" leaves foreground
+color detection to Chawan.</td>
+</tr>
+
+<tr>
+<td>query-da1</td>
+<td>bool</td>
+<td>Enable/disable querying Primary Device Attributes, and with it, all
+"dynamic" terminal querying.<br>
+It is highly recommended not to alter the default value (which is true), or the
+output will most likely look horrible. (Except, obviously, if your terminal does
+not support Primary Device Attributes.)</td>
 </tr>
 
 </table>