You are not logged in.
Pages: 1
This magical prompt will cycle through the colors of the rainbow! It'll work properly if your terminal follows ANSI colors. (i.e. it works on the Linux console)
UPDATE: Version 1.0.0 released! Includes new random_hue function for random colors!
In your .bashrc file:
# Magic Prompt 1.0.0
function next_hue
{
color=$((31 + (++color % 7))) # set 31 to 30 for dark on light
PS1="\[\e[1;${color}m\]\\$ $reset" # set 1 to 0 for dark on light
}
function random_hue
{
color=$(($RANDOM % 7 + 31)) # set 31 to 30 for dark on light
PS1="\[\e[1;${color}m\]\\$ $reset" # set 1 to 0 for dark on light
}
PROMPT_COMMAND="random_hue"
Try it out, and comment out your old PS1. It's cool if you hold down the return key.
Last edited by Anikom15 (2010-11-30 03:53:44)
Personally, I'd rather be back in Hobbiton.
Offline
I can confirm both that it works and that it is absolutely ridiculous.
Do you happen to know the trick to having multiple commands set to the PROMPT_COMMAND variable?
Offline
Hillarious waste of the PROMPT_COMMAND, but still hillarious. @drcouzelis: no, sadly this isn't something you can really get around. ZSH offers the ability to specify multiple precmd hooks.
I've condensed it into pure awesome:
next_hue() {
color=$(( 30 + (++color % 8) ))
echo -ne "\e[1;${color}m" # change 1 to 0 for darker colors
}
PROMPT_COMMAND=next_hue
PS1="\$\[\e[0m\] "
Last edited by falconindy (2010-11-29 04:30:14)
Offline
I figured there was some kind of pattern to it but I was too lazy to bother. I also made one that changes the prompt to a random color. I'll post it later.
Personally, I'd rather be back in Hobbiton.
Offline
Nice to see you post something productive for once .
Got Leenucks? :: Arch: Power in simplicity :: Get Counted! Registered Linux User #392717 :: Blog thingy
Offline
Do you happen to know the trick to having multiple commands set to the PROMPT_COMMAND variable?
Simply do this if you already have a PROMPT_COMMAND you wish to keep:
PROMPT_COMMAND="next_hue; $PROMPT_COMMAND"
There's no reason PROMPT_COMMAND can't contain multiple commands.
Offline
this is awesome
Offline
Pages: 1