Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: can zsh set background color?



On Tue, 4 Jan 2005, Drew Perttula wrote:

> 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])"`

Pipe to python?  Why?

setbgcolor() {
  local c1=$(hostname | md5sum) max x
  local -a col
  for x in 0 2 4; do col+=$[16#$c1[x+1,x+2]]; done
  max=${${(On)col}[1]}
  print -n "\x1b]49;#"
  for x in $col; do printf %02x $[40*x/max]; done
  print -n "\x07"
}



Messages sorted by: Reverse Date, Date, Thread, Author