You are not logged in.
Pages: 1
Hi everybody, while playing with the zsh prompt, I had an idea, since, having only one color, is kind of boring...(:D) Why not randomize the color?
The problem, as you can see is that it only gets one color everytime zsh is called, and I want to have it different everytime!
So, here's my prompt, (and the functions):
random_color(){
random -e 7
case $? in
0) color=$white;;
1) color=$green;;
2) color=$blue;;
3) color=$cyan;;
4) color=$magenta;;
5) color=$yellow;;
6) color=$red;;
esac
}
random_color
number_col="%(?.$green%?.$red$?)$reset"
path_col="$color%d$reset"
PROMPT="┌─[$number_col]─[$path_col]
└╼ "Any ideas, anyone?
Offline
Are you calling that with the zsh precmd function? It runs each time just before the prompt is refreshed, much like bash's PROMPT_COMMAND
Last edited by AlanD (2012-04-23 07:23:41)
Offline
Many thanks! 
Offline
Pages: 1
Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.