Sample Header Ad - 728x90

tput setaf color table? How to determine color codes?

154 votes
7 answers
169909 views
I am in the process of colorizing my terminal’s PS1. I am setting color variables using tput; for example, here’s purple: PURPLE=$(tput setaf 125) ### Question: How do I find the color codes (e.g. 125) of other colors? Is there a color table guide/cheat sheet somewhere? I’m just not sure what 125 is … Is there some way to take a hex color and convert into a number that setaf can use?
Asked by mhulse (1859 rep)
Mar 11, 2016, 04:42 AM
Last activity: Apr 27, 2025, 07:42 AM