
Pastel: A command-line tool to generate, analyze, convert and manipulate colors - praveenscience
https://github.com/sharkdp/pastel
======
mkl
This looks really neat. The demo uses a lot of shell pipes though, needing to
type "pastel" out for every processing step. It would be convenient if
something like

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

could be written

    
    
      pastel random mix red lighten 0.2 format hex
    

(not quite possible, I think) or

    
    
      pastel random then mix red then lighten 0.2 then format hex
    

or something.

~~~
ken
GStreamer uses the argument "!" as a pseudo-"|" so you can build multimedia
pipelines without actually using Unix pipelines, or repeating the gst-launch
command:

[https://gstreamer.freedesktop.org/documentation/tutorials/ba...](https://gstreamer.freedesktop.org/documentation/tutorials/basic/gstreamer-
tools.html)

~~~
mstade
Having written a large number of CLIs in the past, I've often come across this
issue but never had a good solution. This is remarkably simple, elegant, and
easily generalized into a CLI framework so it can be implemented with ease.
Thank you for sharing this nugget of gold!

~~~
nerdponx
Sadly Zsh uses ! for history expansion so they'd all have to be escaped in
that shell.

~~~
mstade
Even in the middle of a line, not just at the start?

~~~
nerdponx
Yes, and it's a great feature IMO:

    
    
        touch projects/new-lib/readme
        cd !!:1:h

------
airstrike
Literally last week I was looking for a tool to grep colors from a text file
(say an SVG or a theme file) and was about to start writing one...which wasn't
going to be even half as neat as this, so thank you very much for sharing

------
otterpro
Another great tool from sharkdp written in Rust (such as bat, hyperfine,
diskus, fd, etc).

------
kaikki
I love every single tool this guy builds

------
hcarvalhoalves
I had to create some diagrams and needed a way to generate palettes
programatically, this will come in handy since I can iterate over HSL space
and convert back to RGB since the diagram tool only accepts RGB! If the OP is
the author please send the info, let me pay you a beer ;)

------
mises
I was just looking for something that could print hex color codes to the
terminal the other day. The best solution I found was some hacky perl script
which was hit-or-miss with certain colors, for some odd reason. Much
appreciated.

~~~
simcop2387
Probably the perl script only supported 256 color modes, 24bit colors from the
terminal are a relatively new item in terms of support in terminals.

------
mstade
For us Macheads it looks like there's a brew formula in the works:
[https://github.com/Homebrew/homebrew-
core/pull/43459](https://github.com/Homebrew/homebrew-core/pull/43459)

I do a fair bit of viz work, this tool could come in handy for generating
color schemes I think.

~~~
nerdponx
FWIW, Linuxbrew is shaping up to be a solid tool as well.

Want to install your favorite text editor on a server and don't have root?
Need a CLI utility and your sysadmin is slow/lazy? System package is ancient
and you need a newer version? Linuxbrew solves all of those problems.

Heck, you could even rig up a shell script to toggle among Brew installations
in order to create self-contained dev environments, synchronize with a
Brewfile, and generate a Brewfile.lock.

------
simplify
I usually use hslpicker.com for tweaking colors, but this looks useful for
seeing an array of colors at once.

------
mattnewport
I was looking for a quick way to convert RGB 0-255 to RGB float 0.0-1.0 (often
used in shaders and other areas of 3D programming) just the other day. This
tool doesn't currently seem to support that, would be a nice addition.

~~~
AceJohnny2
Is it not sufficient to floating-point divide the input values by 255 ?

Edit: I guess that, even as simple as it would be to implement, it still is
another useful output format

~~~
mattnewport
Simple to implement yeah, hard for me to do in my head hence the need for a
tool :-)

~~~
contingencies
$ command |sed 's/$/\/255/' | bc # or similar?

------
hu3
3 days ago:
[https://news.ycombinator.com/item?id=20798453](https://news.ycombinator.com/item?id=20798453)

~~~
mkl
No comments though, and very few up votes.

From the FAQ (see footer):

"Are reposts ok?

If a story has had significant attention in the last year or so, we kill
reposts as duplicates. If not, a small number of reposts is ok."

~~~
hu3
TIL. I'll keep that in mind for my submitions.

Thanks!

