Pastel, a tool to work with colors from the terminal

about cake

In this article we are going to take a look at Pastel. It is a free and open source command line tool for working with colors. We can convert colors from one format to another, display and analyze colors from the terminal and even use a color selector, among other possibilities.

This tool is written in Rust and it was launched a few days ago, but already contemplates quite a few use cases. With it we will be able to perform quick and simple operations such as converting between formats or choosing a color from the screen, to using it in scripts to generate color palettes or manipulate colors in themes.

The tool is compatible with many formats and color spaces different, including RGB, HSL, CIELAB, CIELCh, as well as 8-bit and 24-bit ANSI representations.

Download and install Pastel

In the versions page Cake we are going to find the binaries for Gnu / Linux (.DEB and generic) and macOS. Pastel can also be installed through Cargo. If you are interested, you can consult all installation options for more details from the project's GitHub page.

If you want to install this software on Ubuntu, just follow the instructions below. The first thing will be to open the terminal (Ctrl + Alt + T) and in it first use wget to download today's latest version of the .deb package:

download cake with wget

wget "https://github.com/sharkdp/pastel/releases/download/v0.5.3/pastel_0.5.3_amd64.deb"

Once the download is finished, we can proceed to installation typing in the same terminal:

pastel .deb package installation

sudo dpkg -i pastel_0.5.3_amd64.deb

Options available in Pastel

cake options

When we use Pastel we will have a certain number of options or subcommands available. Among them we can find:

  • color → Will show sample information about the given color.
  • list → It will offer us a screen color name list availables.
  • random → Generate a random color list.
  • distinct → Will generate a set of visually distinct colors, maximizing the perceived color difference between color pairs.
  • sort-bySort a list of colors by the given property.
  • pickInteractively select a screen color. Here it should be noted that for the color picker command to work, we will need to have an external color picker installed. Users will be able to choose between gpick, xcolor y colorpicker.
  • format Convert the given colors to a specific format.
  • paintPrint text in color using ANSI escape sequences.
  • gradient → Generate a color sequence interpolated between 'start' and 'stop'.
  • mixCreate new colors by interpolating between two colors in the given space.
  • SATURATED Increase color saturation in a specific amount.
  • desaturateDecrease color saturation in a specific amount.
  • lightenLightens the color in a specified amount.
  • darkenDarken the color in a specified amount.
  • rotateRotate the tone channel by the specified angle.
  • complementGet the complementary color (pitch rotated 180 °).
  • grayCreate a gray shade from a given clarity.
  • to grayFully desaturate a color (preserves luminance).
  • textcolorReturns a readable foreground text color (black or white) for a given background color.

Some usage examples

Format name will show us the name of a given color:

name color

pastel format name 44cc11

El color subcommand is going to us display information about colors that we add in hexadecimal:

pastel three colors

pastel color 0E5478 4ecdc4 c7f484

We will be able get two random colors using the random subcommand from the Pastel tool:

random colors with pastel

pastel random -n 2

When using the mix subcommand, We create a new color mixing red and blue (in this example) in RGB color space:

mix two pastel colors

pastel mix --colorspace=RGB red blue

We will be able to use the sort-by command for sort 10 random colors by hue and format the output to hexadecimal:

ten random colors in hex

pastel random -n 10 | pastel sort-by hue | pastel format hex

On its GitHub page the developer offers un Animated Demo GIF on how to use this tool.

uninstall

To eliminate this tool we will only have to open a terminal (Ctrl + Alt + T) and in it execute the following command:

sudo apt remove pastel

Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.