[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Variable colors in hardstatus line
From: |
Chris Jones |
Subject: |
Re: Variable colors in hardstatus line |
Date: |
Wed, 28 Jan 2009 19:31:11 -0500 |
User-agent: |
Mutt/1.5.13 (2006-08-11) |
On Wed, Jan 28, 2009 at 01:50:44PM EST, Adrian Rollett wrote:
> I've found that the only way to implement something like this is to
> have your backtick script vary the output according to the
> temperature. For instance, here's a fragment from a script I use to
> output the current disk use, colored according to percentage used:
> if [[ "${PERCENTAGE}" -lt 85 ]]
> then
> echo -n "{= Kg}${HOST} ${DISK} (${PERCENTAGE}%)"
> elif [[ "${PERCENTAGE}" -lt 92 ]]
> then
> echo -n "{= Ky}${HOST} ${DISK} (${PERCENTAGE}%)"
> else
> echo -n "{= Kr}${HOST} ${DISK} (${PERCENTAGE}%)"
> fi
> echo "{= Kk}"
This is pretty much what I was planning to do but I missed something
rather obvious:
I need to conform to screen's "STRING ESCAPES" syntax for coloring and
therefore I can't just use the underlying xterm's ctlseq's as I was
naively trying to do. :-(
Or to put it another way, since screen's syntax only supports 8+8 colors
via the "color" letters [k, r, g, y, .. etc.] plus the "bold" attribute
for brighter versions.. it looks like I would need to add 256-color
support to screen's hardstatus line first and then use th "extended
syntax" in my scripts.
Sounds like a lot of work for something the vast majority of screen
users would consider totally silly, with the caveat that whatever I came
up with would likely never make it into mainstream screen and I would
have to maintain my patch separately.
I guess I'll use your solution above for now and tweak the 16-color
color palette in my X resource file to something a bit more civilized
than the xterm defaults.
Thanks, much appreciated!
CJ