A command to print terminal color codes

last updated: Jul 19, 2024

I write shell scripts that use terminal colors often enough that it's handy to know a bit about them, but not often enough that I remember how they work without looking it up.

So, this morning, I wrote colors, a shell script that prints out tables of the basic ANSI colors and text effects, and demonstrates what they look like on your terminal.

Here's the script, and here's what it looks like on a mostly-stock apple terminal.app with a dark color scheme:

You can pass -v to the script to get a table of the 8-bit colors, in case you want to get real fancy with your script:

↑ up