Pastel Is A New Tool To Work With Colors From The Terminal
Pastel is a new free and open source command line tool to work with colors / perform various color operations. It's written in Rust, and it can convert colors from one format to another, show and analyze colors on the terminal, generate a set of visually distinct colors, and there's even a color picker, along with much more.
The tool has support for many different color formats and color spaces, including RGB, HSL, CIELAB, CIELCh as well as ANSI 8-bit and 24-bit representations.
Available Pastel subcommands:
color
: Display information about the given colorlist
: Show a list of available color namesrandom
: Generate a list of random colorsdistinct
: Generate a set of visually distinct colors by maximizing the perceived color difference between pairs of colorssort-by
: Sort a list of colors by the given propertypick
: Interactively pick a color from the screen (pipette)format
: Convert the given color(s) to a specific formatpaint
: Print colored text using ANSI escape sequencesgradient
: Generate a sequence of colors that interpolates between 'start' and 'stop'. The interpolation is performed in the specified color spacemix
: Create new colors by interpolating between two colors in the given colorspacesaturate
: Increase color saturation by a specified amountdesaturate
: Decrease color saturation by a specified amountlighten
: Lighten color by a specified amountdarken
: Darken color by a specified amountrotate
: Rotate the hue channel by the specified anglecomplement
: Get the complementary color (hue rotated by 180°)gray
: Create a gray tone from a given lightnessto-gray
: Completely desaturate a color (preserving luminance)textcolor
: Return a readable foreground text color (either black or white) for a given background color. This can also be used in the opposite way, i.e. to create a background color for a given text color.
It's worth noting that for the color picker command to work (
pastel pick
), you'll need to have an external color picker installed, users being able to choose from gpick, xcolor, grabc, colorpicker and chameleon.You may also like: 179 Color Schemes For Your Gtk-Based Linux Terminal (Gnome Terminal, Tilix, Xfce Terminal, More)
A few Pastel examples, with screenshots:
- Using the Pastel
color
subcommand to show information on 3 colors in hex (pastel color 556270 4ecdc4 c7f484
):- Using the Pastel
random
subcommand (pastel random -n 3 --strategy lch_hue
):- Using the Pastel
sort-by
command to sort 20 random colors by hue, and format the output in hex (pastel random -n 20 | pastel sort-by hue | pastel format hex
):- Using the Pastel
mix
subcommand to create a new color by mixing red and blue in the RGB colorspace (pastel mix --colorspace=RGB red blue
):You can also view a Pastel demo GIF created by its developer on the program's GitHub.
You'll probably want to use Pastel with a terminal emulator that supports "true color" (24bit), although Pastel does have 8bit mode and no color modes as well. By default it tries to autodetect the mode it should run in, but you may also specify it on the command line, using
-m / --color-mode
, followed by the one of the following modes: 24bit, 8bit, off, or auto. Most terminal emulators support "true color" though - including iTerm2, Konsole, Termux, and all libvte 0.36 or newer based terminal emulators, naming here Gnome Terminal, Xfce4 Terminal, Terminator, Tilix, Guake, Pantheon Terminal, LXTerminal, Tilda, and so on. Pastel actually has an option you can use to check if your terminal emulator supports 24-bit colors or not - all you have to do is run
pastel colorcheck
.Pastel had its first release only 5 days ago but it is quite competent already, having quite a few use cases, from performing quick, simple operations like converting between formats or picking a color from the screen, to using it in scripts to generate color palettes or manipulate colors in themes or SVG files, and so on.
Download Pastel
The Pastel releases tab has Linux (DEB and generic) and macOS binaries. You may also install Pastel via Cargo, or using an AUR package for Arch Linux. Check out the installation instructions from GitHub for details.