Tired of searching "matplotlib colors" every week/day/hour? This simple script displays them all conveniently right in your terminal emulator! This uses matplotlib.colors to get color names and RGB values and prints with ANSI escape sequences.
It can also print all of the built-in colorbars.
This requires a terminal with true color support. Notably, Mac's Terminal.app does not have this and so the colors cannot be properly displayed. I'm not sure that that is a workaround for this. On Mac I suggest switching to a different terminal emulator with more modern support such as kitty or iTerm.
You just need a Python distribution with matplotlib.
It's probably easiest to create an alias in your shell's rc file (e.g.,
~/.bashrc) such as
alias mplcolors='python /path/to/dir/mplcolors.py'
then you can just run
to print the colors.
You may display all of the available xkcd colors by passing the option
-a or flag
To display all of the built-in colormaps, use the
-b flag ("b" for "bars") or the
Color lookup, color grouping.
Print subset of colormaps