public inbox for util-linux@vger.kernel.org
 help / color / mirror / Atom feed
* terminal-colors.d changes
@ 2014-05-13 11:38 Karel Zak
  2014-05-13 18:16 ` Mantas Mikulėnas
  0 siblings, 1 reply; 3+ messages in thread
From: Karel Zak @ 2014-05-13 11:38 UTC (permalink / raw)
  To: util-linux


 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

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: terminal-colors.d changes
  2014-05-13 11:38 terminal-colors.d changes Karel Zak
@ 2014-05-13 18:16 ` Mantas Mikulėnas
  2014-05-14  8:19   ` Karel Zak
  0 siblings, 1 reply; 3+ messages in thread
From: Mantas Mikulėnas @ 2014-05-13 18:16 UTC (permalink / raw)
  To: util-linux

On 2014-05-13 14:38, Karel Zak wrote:
>   * "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

-- 
Mantas Mikulėnas <grawity@gmail.com>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: terminal-colors.d changes
  2014-05-13 18:16 ` Mantas Mikulėnas
@ 2014-05-14  8:19   ` Karel Zak
  0 siblings, 0 replies; 3+ messages in thread
From: Karel Zak @ 2014-05-14  8:19 UTC (permalink / raw)
  To: Mantas Mikulėnas; +Cc: util-linux

On Tue, May 13, 2014 at 09:16:40PM +0300, Mantas Mikulėnas wrote:
> On 2014-05-13 14:38, Karel Zak wrote:
> >   * "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].)

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).

> 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

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-05-14  8:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-13 11:38 terminal-colors.d changes Karel Zak
2014-05-13 18:16 ` Mantas Mikulėnas
2014-05-14  8:19   ` Karel Zak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox