Signup/Sign In
Ask Question
Not satisfied by the Answer? Still looking for a better solution?

What color codes can I use in my PS1 prompt?

I used several colors in my PS1 prompt such as
\033]01;31\] # pink
\033]00m\] # white
\033]01;36\] # bold green
\033]02;36\] # green
\033]01;34\] # blue
\033]01;33\] # bold yellow


Where can I find a list of the color codes I can use?
by

1 Answer

Bharatgxwzm
I wrote a bash function that can show you all the colors, if this helps.
function colorgrid( )
{
iter=16
while [ $iter -lt 52 ]
do
second=$[$iter+36]
third=$[$second+36]
four=$[$third+36]
five=$[$four+36]
six=$[$five+36]
seven=$[$six+36]
if [ $seven -gt 250 ];then seven=$[$seven-251]; fi

echo -en "\033[38;5;$(echo $iter)m? "
printf "%03d" $iter
echo -en " \033[38;5;$(echo $second)m? "
printf "%03d" $second
echo -en " \033[38;5;$(echo $third)m? "
printf "%03d" $third
echo -en " \033[38;5;$(echo $four)m? "
printf "%03d" $four
echo -en " \033[38;5;$(echo $five)m? "
printf "%03d" $five
echo -en " \033[38;5;$(echo $six)m? "
printf "%03d" $six
echo -en " \033[38;5;$(echo $seven)m? "
printf "%03d" $seven

iter=$[$iter+1]
printf '\r\n'
done
}

Login / Signup to Answer the Question.