tput colorsProbably you'll get number 8, for 8 colors. I found out this reading feature list for Fedora 18. Even more interestingly, they mention that MacOS X Lion supports 256 colors in terminal by default.
So, naturally, I decided to try to see if I can turn on support for 256 colors, and it seems to work. In order to have so many colors first you have to define appropriate terminal. That one was easy, it turns out there is terminal definition under the name xterm-256color. So, set your terminal to that value, i.e.:
export TERM=xterm-256colorAnd you can use 256 colors. :) Ok, but how to check if there are really 256 available colors? One way is to use tput command again:
But how to see what colors are there? With a bit of googling it turns out that background color can be set with the following command:$ tput colors256
that command will set background to NUM. So, a small for loop will print all 256 colors:tput setaf NUM
for i in {0..255}; do tput setab $i; echo -n " "; done; tput setab 0; echoActually, the last tput and echo commands are so that terminal is brought back to working state. :)
No comments:
Post a Comment