Bash PS1 256 colors with bold

bashcolorspromptterminal

I want to list all colors that I can use in bash console. And after it I want to set my prompt to be bold and orange like color. I'm using this to do listing color codes for me:

for code in {0..255}; do echo -e "\e[38;05;${code}m $code: Test"; done

But the question is how to make it bold and keep colors?

I looked for some advice about making it bold here: http://misc.flogisoft.com/bash/tip_colors_and_formatting but I couldn't found any code that combines bold and one of 256 colors.

Best Answer

You can write it as any of those:

echo -e "\e[1;38;05;${code}m $code: Test"
echo -e "\e[1m\e[38;05;${code}m $code: Test";
echo -e "\e[38;05;${code}m\e[1m $code: Test";
echo -e "\e[38;05;${code};1m $code: Test";
tput bold; tput setaf "$code" # provided the terminfo database is
                              # properly populated

You can run tput bold only once provided you don't reset the boldness with a tput sgr0 or \e[m or \e[0m.