Skip to contentSkip to conversation

terminal-colors.d changes

DISCUSSION Karel Zak 2 participants 3 messages May 13, 2014 – May 14, 2014 Util-Linux package

lore
Share & tools
lore

Karel Zak

author maintainer
#0 lore raw

I have merged some improvements:

* $XDG_CONFIG_HOME/terminal-colors.d and $HOME/.config/terminal-colors.d are supported now

* @termname suffix is possible to use to restrict the setting to specified terminal, for example

touch /etc/terminal-colors.d/@vt100.disable

to disable colors for all utils with TERM=vt100

* "scheme" files to customize colors are supported now, for example

echo 'alert 37;41' >> /etc/terminal-colors.d/dmesg.scheme

sets red background color for alert messages.

The scheme files supports color names (e.g. "red"), ANSI color sequences (e.g. 37;41) and escape sequences (e.g. \a for bell).

* all this is optional and with almost zero overhead for systems without terminal-colors.d/

Karel

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com
#1 lore raw
Quoted 8 lines · Karel Zak

* "scheme" files to customize colors are supported now, for example

echo 'alert 37;41' >> /etc/terminal-colors.d/dmesg.scheme

sets red background color for alert messages.

The scheme files supports color names (e.g. "red"), ANSI color sequences (e.g. 37;41) and escape sequences (e.g. \a for bell).

Does it support multiple escape sequences?

The 16/256/RGB-color sequence is a bit _odd_ in that it consists of three parameters (e.g. \e[38;5;72m for color72) and generally cannot be mixed with other sequences. (Some terminals allow this, others forbid, particularly mosh [1].)

I guess right now 'alert 38;5;16m\e[48;5;202' would work, but it just doesn't feel right.

[1]: https://github.com/keithw/mosh/issues/110

Signature · 1 line
Mantas Mikulėnas <[email protected]>
author maintainer
#2 lore raw
Quoted 10 lines · Mantas Mikulėnas
Quoted 8 lines · Karel Zak

* "scheme" files to customize colors are supported now, for example

echo 'alert 37;41' >> /etc/terminal-colors.d/dmesg.scheme

sets red background color for alert messages.

The scheme files supports color names (e.g. "red"), ANSI color sequences (e.g. 37;41) and escape sequences (e.g. \a for bell).

Quoted 6 lines

Does it support multiple escape sequences?

The 16/256/RGB-color sequence is a bit _odd_ in that it consists of three parameters (e.g. \e[38;5;72m for color72) and generally cannot be mixed with other sequences. (Some terminals allow this, others forbid, particularly mosh [1].)

Yes, for example

echo 'warn 38;5;72' >> /etc/terminal-colors.d/dmesg.scheme

works. The \e[ m is unnecessary (we follow coreutils dir colors semantic).

Quoted 2 lines

I guess right now 'alert 38;5;16m\e[48;5;202' would work, but it just doesn't feel right.

alert 38;5;16m\e[48;5;202

works, but in this case more consistent and readable notation is probably

alert \e[38;5;16m\e[48;5;202m

that works too.

(The result is orange background and black foreground, right? :-)

Karel

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com