[pacman-dev] coloured pacman
Jürgen Hötzel
juergen at hoetzel.info
Tue Feb 6 16:20:11 EST 2007
On Tue, Feb 06, 2007 at 02:37:04PM -0600, Aaron Griffin wrote:
> On 2/6/07, Dan McGee <dpmcgee at gmail.com> wrote:
> > On 2/6/07, Jürgen Hötzel <juergen at hoetzel.info> wrote:
> > > Its not easy to display colored text in a portable way. An easy, but
> > > wrong way is using ANSI escape sequences directly because you make
> > > assumption about the tty.
> > >
> > > A much more portable way is querying the database of terminal capabilities
> > > (termcap/terminfo).
> > >
> > > Jürgen
> >
> > Much better put than my point about hardcoding the escape sequences in
> > C code. Although not necessarily good in a bash script, the code can
> > be edited if necessary quite easily to fix escape sequences. However,
> > Jürgen makes the excellent point that these escape sequences cannot
> > always be assumed to be portable.
>
> And, one of the things I said the last time (6 months ago?) about this
> topic, was that, it'd be nice to support bold/underline or whatever on
> mono terminals too, in the absence of color. That'd be real fancy.
> _______________________________________________
Possible by querying the terminfo database. In Shell:
if ! tput setf 4; then # try red
tput bold; # else bold
fi
Jürgen
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://archlinux.org/pipermail/pacman-dev/attachments/20070206/83bd9531/attachment.pgp>
More information about the pacman-dev
mailing list