Quantcast
Viewing latest article 12
Browse Latest Browse All 28

Show numerical values for each of the 256 colors in bash

$ for i in {0..255}; do echo -e "\e[38;05;${i}m${i}"; done | column -c 80 -s ' '; echo -e "\e[m"

I like the other three versions but one uses nested loops and another prints every color on a separate line. Both versions fail to reset colors before giving the prompt back.

This version uses the column command to print a table so all the colors fit on one screen. It also resets colors back to normal before as a last step.

Image may be NSFW.
Clik here to view.
commandlinefu.com

by David Winterbottom (codeinthehole.com)


Viewing latest article 12
Browse Latest Browse All 28

Trending Articles