pastel
A command-line tool to generate, analyze, convert and manipulate colors.
pastel provides a collection of commands to work with colors on the terminal. It supports many different color formats and color spaces like RGB, HSL, CIELAB, CIELCh as well as ANSI 8-bit and 24-bit representations.
In action

Tutorial
Getting help
pastel provides a number of commands like saturate, mix or paint. To see a complete list, you can simply run
To get more information about a specific subcommand (say mix), you can call pastel mix -h or pastel help mix.
Composition
Many pastel commands can be composed by piping the output of one command to another, for example:
| | |
Specifying colors
Colors can be specified in many different formats:
lightslategray
'#778899'
778899
789
'rgb(119, 136, 153)'
'119,136,153'
'hsl(210, 14.3%, 53.3%)'
Colors can be passed as positional arguments, for example:
pastel lighten 0.2 orchid orange lawngreen
They can also be read from standard input. So this is equivalent:
printf "%s\n" orchid orange lawngreen | pastel lighten 0.2
You can also explicitly specify which colors you want to read from the input. For example, this mixes red (which is read from STDIN) with blue (which is passed on the command line):
pastel color red | pastel mix - blue
Use cases and demo
Converting colors from one format to another
Show and analyze colors on the terminal
Pick a color from somewhere on the screen
Get a list of all X11 / CSS color names
Print colorized text from a shell script
bg="hotpink"
fg=""
|
Resources
Interesting Wikipedia pages:
- Color difference
- CIE 1931 color space
- CIELAB color space
- Line of purples
- Impossible color
- sRGB
- Color theory
- Eigengrau
Color names:
- XKCD Color Survey Results
- Peachpuffs and Lemonchiffons - talk about named colors
- List of CSS color keywords
Maximally distinct colors:
- How to automatically generate N "distinct" colors?
- Publication on two algorithms to generate (maximally) distinct colors
Other articles and videos: