mplcolors

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.

Compatability

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.

Requirements

You just need a Python distribution with matplotlib.

Useage

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

mplcolors

to print the colors.

screenshot--3--1

You may display all of the available xkcd colors by passing the option -a or flag --all.

To display all of the built-in colormaps, use the -b flag ("b" for "bars") or the --colorbars option

mplcolors -b

screenshot_colorbars

To Do

Color lookup, color grouping.
Print subset of colormaps

GitHub

https://github.com/AstroBarker/mplcolors