Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: can zsh set background color?
- X-seq: zsh-users 8333
- From: Drew Perttula <drewp@'bigasterisk.com.'>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: can zsh set background color?
- Date: Tue, 04 Jan 2005 19:50:58 -0800
- In-reply-to: Your message of "Tue, 04 Jan 2005 10:18:03 EST." <D4174DD1-5E63-11D9-B4A6-000D93AD26C8@xxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
> Is there any way for zsh to set the background color of my terminal
> program?
>
> I'm often logged into to 3 different computers (ssh), and it would be
> handy to be able to quickly look for the color of one to know that it
> was the one where I was connected to X
>
> TjL
> Zsh 4.1.1 on Mac OS X
>
As has been discussed, you'll need a terminal program that accepts escape
codes to change the background color. But if you find that, you might be
interested in my solution, which is to hash the hostname and generate
a color from the result. I get a probably-different background color
every time I connect to a new host.
My code is on http://zshwiki.org/WishList and repeated here:
# tint the terminal for each host
bgcolor=`hostname | md5sum | /usr/local/bin/python -c "c1=raw_input(); col=[int(c1[x:x+2],16) for x in 0,2,4]; print '#%02x%02x%02x'%tuple([40*x/max(col) for x in col])"`
print "\x1b]49;$bgcolor\x07"
Messages sorted by:
Reverse Date,
Date,
Thread,
Author