• Stars
    star
    4,746
  • Rank 8,431 (Top 0.2 %)
  • Language
    Rust
  • License
    Apache License 2.0
  • Created almost 5 years ago
  • Updated 5 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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

pastel

Build Status

pastel is a command-line tool to generate, analyze, convert and manipulate colors. It supports many different color formats and color spaces like RGB (sRGB), HSL, CIELAB, CIELCh as well as ANSI 8-bit and 24-bit representations.

In action

pastel in action

Tutorial

Getting help

pastel provides a number of commands like saturate, mix or paint. To see a complete list, you can simply run

pastel

To get more information about a specific subcommand (say mix), you can call pastel mix -h or pastel help mix.

Composition

Many pastel commands can be composed by piping the output of one command to another, for example:

pastel random | pastel mix red | pastel lighten 0.2 | pastel format hex

Specifying colors

Colors can be specified in many different formats:

lightslategray
'#778899'
778899
789
'rgb(119, 136, 153)'
'119,136,153'
'hsl(210, 14.3%, 53.3%)'

Colors can be passed as positional arguments, for example:

pastel lighten 0.2 orchid orange lawngreen

They can also be read from standard input. So this is equivalent:

printf "%s\n" orchid orange lawngreen | pastel lighten 0.2

You can also explicitly specify which colors you want to read from the input. For example, this mixes red (which is read from STDIN) with blue (which is passed on the command line):

pastel color red | pastel mix - blue

Use cases and demo

Converting colors from one format to another

pastel format hsl ff8000

Show and analyze colors on the terminal

pastel color "rgb(255,50,127)"

pastel color 556270 4ecdc4 c7f484 ff6b6b c44d58

Pick a color from somewhere on the screen

pastel pick

Generate a set of N visually distinct colors

pastel distinct 8

Get a list of all X11 / CSS color names

pastel list

Name a given color

pastel format name 44cc11

Print colorized text from a shell script

bg="hotpink"
fg="$(pastel textcolor "$bg")"

pastel paint "$fg" --on "$bg" "well readable text"
pastel paint -n black --on red --bold "   ERROR!   "
echo " A serious error"

pastel paint -n black --on yellow --bold "  WARNING!  "
echo " A warning message"

pastel paint -n black --on limegreen --bold "    INFO    "
echo -n " Informational message with a "
echo -n "highlighted" | pastel paint -n default --underline
echo " word"

Installation

On Debian-based systems

You can download the latest Debian package from the release page and install it via dpkg:

wget "https://github.com/sharkdp/pastel/releases/download/v0.8.1/pastel_0.8.1_amd64.deb"
sudo dpkg -i pastel_0.8.1_amd64.deb

On Arch Linux

You can install pastel from the Extra repositories:

sudo pacman -S pastel

On Nix

You can install pastel from the Nix package:

nix-env --install pastel

On MacOS

You can install pastel via Homebrew

brew install pastel

On Windows

You can install pastel via Scoop

scoop install pastel

Via snap package

Get it from the Snap Store:

sudo snap install pastel

On NetBSD

Using the package manager:

pkgin install pastel

From source:

cd /usr/pkgsrc/graphics/pastel
make install

On other distributions

Check out the release page for binary builds.

Via cargo (source)

If you do not have cargo, install using rust's installation documentation.

If you have Rust 1.43 or higher, you can install pastel from source via cargo:

cargo install pastel

Alternatively, you can install pastel directly from this repository by using

git clone https://github.com/sharkdp/pastel
cargo install --path ./pastel

Resources

Interesting Wikipedia pages:

Color names:

Maximally distinct colors:

Other articles and videos:

License

Licensed under either of

at your option.

More Repositories

1

bat

A cat(1) clone with wings.
Rust
45,968
star
2

fd

A simple, fast and user-friendly alternative to 'find'
Rust
31,156
star
3

hyperfine

A command-line benchmarking tool
Rust
18,256
star
4

hexyl

A command-line hex viewer
Rust
8,565
star
5

insect

High precision scientific calculator with support for physical units
PureScript
3,147
star
6

dbg-macro

A dbg(…) macro for C++
C++
2,719
star
7

cube-composer

A puzzle game inspired by functional programming
PureScript
1,967
star
8

vivid

A themeable LS_COLORS generator with a rich filetype datebase
Rust
1,479
star
9

shell-functools

Functional programming tools for the shell
Python
1,133
star
10

binocle

a graphical tool to visualize binary data
Rust
964
star
11

diskus

A minimal, fast alternative to 'du -sh'
Rust
936
star
12

numbat

A statically typed programming language for scientific computations with first class support for physical dimensions and units
Rust
734
star
13

great-puzzles

A curated list of great puzzles
484
star
14

purescript-flare

A special-purpose UI library for Purescript
PureScript
286
star
15

lscolors

A Rust library and tool to colorize paths using LS_COLORS
Rust
235
star
16

trigger

Run a user-defined command on file changes
Shell
181
star
17

bugreport

Rust library to collect system and environment information for bug reports
Rust
131
star
18

quizzity

A fast-paced geography quiz
JavaScript
125
star
19

curiosity

How far does your curiosity take you?
HTML
99
star
20

lucid

A simple mock-application for programs that work with child processes
Rust
86
star
21

parachuting-robots

An interactive version of a classic puzzle
PureScript
78
star
22

purescript-sparkle

Infer user interfaces from type signatures
PureScript
75
star
23

stack-inspector

A gdb command to inspect the size of objects on the stack
Python
62
star
24

painless

Painless parameter handling for easy exploration
C++
60
star
25

yinsh

A web-based version of the board game Yinsh
Haskell
59
star
26

purescript-isometric

Isometric rendering for PureScript
PureScript
58
star
27

pysh

Python-enhanced bash scripts
Python
58
star
28

purescript-quantities

Physical quantities and units
PureScript
53
star
29

minicpp

A REPL-style development environment for small C++ snippets
Shell
48
star
30

purescript-ctprelude

A Prelude with names from category theory
PureScript
48
star
31

qrnet

A neural network that decrypts QR codes
Python
43
star
32

riffle

A simple terminal pager (as a library)
Rust
41
star
33

config-files

A set of configuration files for vim, zsh, i3, ...
Python
37
star
34

content_inspector

Fast inspection of binary buffers to guess/determine the type of content
Rust
32
star
35

factorization-diagrams

Interactive factorization diagrams
HTML
27
star
36

argmax

Rust library to deal with "argument too long" errors
Rust
20
star
37

vacuum-robot-simulator

Simulation environment for an autonomous robot
Rust
19
star
38

sub

A command-line tool for string substitutions (RustLab 2019 workshop)
Rust
16
star
39

purescript-format

Type-safe, printf-style formatting for PureScript
PureScript
15
star
40

PaperLocator

Citation parsing to quickly access publications
JavaScript
14
star
41

purescript-decimals

Arbitrary precision numbers for PureScript
PureScript
13
star
42

flare-example

Quick start project for purescript-flare
PureScript
11
star
43

fd-benchmarks

Benchmarks for 'fd'
Shell
10
star
44

tinytag

tinytag is a "URL" shortener for your filesystem
Python
10
star
45

purescript-flaredoc

Interactive documentation with Flare
PureScript
8
star
46

phd-thesis

LaTeX sources for my PhD thesis
TeX
7
star
47

level11

7
star
48

GPE-Solver

Split-step solver for the 3D (dipolar) Gross-Pitaevskii equation
C++
7
star
49

latex-report

A clean and simple LaTeX template for reports
TeX
7
star
50

Pack-Zack

A tag-based manager for packing lists
CSS
7
star
51

dp

Personal website about some of my open source projects, board games and mountainbiking.
HTML
5
star
52

cs231n

My solutions to the CS231n assignments
Jupyter Notebook
4
star
53

imdb-ratings

Statistical analysis of my IMDB movie ratings
Jupyter Notebook
3
star
54

purescript-pairs

Datatype and functions for pairs of values
PureScript
3
star
55

zehntausend

A solver for the dice game Zehntausend
Haskell
3
star
56

gnuplot-mm

GnuPlot bindings for Mathematica
Mathematica
2
star
57

talk-moderne-programmiersprachen

JavaScript
2
star
58

rock-paper-scissors

Interactive regex puzzle
HTML
2
star
59

purescript-gametree

Algorithms for two-player zero-sum games
PureScript
2
star
60

snake-factory

A work-in-progress game with monadic parsers and snakes
PureScript
1
star
61

gomoku

Five in a row
PureScript
1
star