In the next article we are going to take a look at Pastel. This is a tool that is currently in your version 0.8.1. This program, if we are interested generate, analyze, convert and manipulate colors, it will allow us to do it from the command line. The program is written using Rust, and is released under the licenses Apache License (Version 2.0) Y MIT license.
As I was saying, pastel is a tool to use in the terminal, and with which users can generate, analyze, convert and manipulate colors. Is supports many different formats and color spaces, such as RGB (sRGB), HSL, CIELAB, CIELCh, as well as 8- and 24-bit ANSI representations.
Install Pastel on Ubuntu
As snap package
For install this utility on our Ubuntu system as snap pack (version 0.8.0), we will only need to open a terminal (Ctrl + Alt + T) and execute the installation command in it:
sudo snap install pastel
If at another time you need update the program, when a new version appears, you just need to type the command:
sudo snap refresh pastel
After installation, in a terminal (Ctrl + Alt + T) we can check available options writing in it:
pastel -h
Uninstall
Removing this application from our system is as simple as installing it. It will only be necessary open a terminal (Ctrl + Alt + T) and use the corresponding uninstall command in it:
sudo snap remove pastel
As a .deb package
The latest version of this program can be found available from the project releases page. In addition, to get the latest version (0.8.1) published today, we will also have the possibility of opening a terminal (Ctrl + Alt + T) and using wget to download the required .deb package:
wget https://github.com/sharkdp/pastel/releases/download/v0.8.1/pastel_0.8.1_amd64.deb
When the download is complete, we can proceed to install the package. To do this, in the same terminal we will execute:
sudo dpkg -i pastel_0.8.1_amd64.deb
At the end of the installation, it only remains to start using the program. For check that the installation was successful, you just have to type in the command line:
pastel -V
Uninstall
For remove the installed program with the .deb package, it is only necessary to open a terminal (Ctrl + Alt + T) and execute in it:
sudo apt remove pastel
A quick look at Pastel
Get help
This tool will provide us with a series of options, such as saturate, blend or paint. For see a complete list of all the possibilities that it offers us, it is only necessary to write in the terminal the name of the program:
pastel
For get more information about a specific option (for example, paint), we can use in the terminal:
pastel paint -h
Another way to get the same result, it would be writing:
pastel help paint
Show the name of a color
The option format name is going to show us the name of a given color:
pastel format name 44ca12
Show details of a color
The option color will show us information about the colors that we add in hexadecimal:
pastel color 0E5478 c7f484
Get random colors
We will be able get two random colors using option random of this tool as follows:
pastel random -n 2
Channel options
A lot of the options that we can use with pastel can be composed by channeling the output of one command to another. An example of this would be:
pastel random | pastel mix red | pastel lighten 0.2 | pastel format hex
Pass colors as arguments
Colors can be pass as positional arguments. An example of this would be:
pastel lighten 0.2 orchid orange lawngreen
Read colors from standard input
Too colors can be read from standard input:
printf "%sn" orchid orange lawngreen | pastel lighten 0.2
Mix colors
When using the option mix we will be able to create a new color. For example, if we mix yellow and red in the RGB color space, the result obtained would be the following:
pastel mix --colorspace=RGB yellow red
Format conversion
This tool will also allow us convert colors from one format to another:
pastel format hsl ff8000
Users can consult interesting resources from one of the sections offered in the project’s GitHub repository.