Pastel Is A New Tool To Work With Colors From The Terminal

Pastel command-line tool to generate, analyze, convert and manipulate colors

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 color
  • list: Show a list of available color names
  • random: Generate a list of random colors
  • distinct: Generate a set of visually distinct colors by maximizing the perceived color difference between pairs of colors
  • sort-by: Sort a list of colors by the given property
  • pick: Interactively pick a color from the screen (pipette)
  • format: Convert the given color(s) to a specific format
  • paint: Print colored text using ANSI escape sequences
  • gradient: Generate a sequence of colors that interpolates between 'start' and 'stop'. The interpolation is performed in the specified color space
  • mix: Create new colors by interpolating between two colors in the given colorspace
  • saturate: Increase color saturation by a specified amount
  • desaturate: Decrease color saturation by a specified amount
  • lighten: Lighten color by a specified amount
  • darken: Darken color by a specified amount
  • rotate: Rotate the hue channel by the specified angle
  • complement: Get the complementary color (hue rotated by 180°)
  • gray: Create a gray tone from a given lightness
  • to-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):

pastel show color info

- Using the Pastel random subcommand (pastel random -n 3 --strategy lch_hue):

pastel random colors

- 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):

pastel sort-by

- 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):

Pastel mix

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.