Live data from Hacker News

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

github.com

21–30 of 30 posts

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

#21
post #15
post #13

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.

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...

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!

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

#23
post #22

For us Macheads it looks like there's a brew formula in the works: 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.

  brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/4e60ba14762ad17eef498ce5719aa06bc639d2b1/Formula/pastel.rb

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

#24
post #22

For us Macheads it looks like there's a brew formula in the works: 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.

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.

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

#25
post #21
post #15

Earlier quoted context omitted.

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...

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!

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

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

#26
post #21

Earlier quoted context omitted.

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!

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

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

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

#28
post #16

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.

Thank you for the feedback. I have added a new "rgb-float" format in the latest release: https://github.com/sharkdp/pastel/releases/tag/v0.5.3

Awesome, thanks!

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

#29
post #17
post #15

Earlier quoted context omitted.

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...

That would be great. pastel random ! mix red ! lighten 0.2 ! format hex

I made a wrapper to support this: https://gist.github.com/ayosec/816ccba7a75aba5336db0fe0b9791...

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

#30
post #26

Earlier quoted context omitted.

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

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

Yes, and it's a great feature IMO:

    touch projects/new-lib/readme
    cd !!:1:h
Post reply on HN