5 ms·
Pastel: A command-line tool to generate, analyze, convert and manipulate colors
- mises 7y agoI 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 7y agoProbably the perl script only supported 256 color modes, 24bit colors from the terminal are a relatively new item in terms of support in terminals.
- mattnewport 7y agoI 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 7y agoIs 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
- deleted 7y ago[deleted]
- mattnewport 7y agoSimple to implement yeah, hard for me to do in my head hence the need for a tool :-)
- contingencies 7y ago$ command |sed 's/$/\/255/' | bc # or similar?
- sharkdp 7y agoThank 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 https://github.com/sharkdp/pastel/releases/tag/v0.5.3
- mattnewport 7y agoAwesome, thanks!
- hcarvalhoalves 7y agoI 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 ;)
- simplify 7y agoI usually use hslpicker.com for tweaking colors, but this looks useful for seeing an array of colors at once.
- hu3 7y ago3 days ago: https://news.ycombinator.com/item?id=20798453 https://news.ycombinator.com/item?id=20798453
- mkl 7y agoThis 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 7y agoGStreamer 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/basic/gstreamer-tools.html https://gstreamer.freedesktop.org/documentation/tutorials/ba...
- mkl 7y agoThat would be great. pastel random ! mix red ! lighten 0.2 ! format hex
- ayosec 7y agoI made a wrapper to support this: https://gist.github.com/ayosec/816ccba7a75aba5336db0fe0b9791e4d https://gist.github.com/ayosec/816ccba7a75aba5336db0fe0b9791...
- mstade 7y agoHaving 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 7y agoSadly Zsh uses ! for history expansion so they'd all have to be escaped in that shell.
- airstrike 7y agoLiterally 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
- kaikki 7y agoI love every single tool this guy builds
- mstade 7y agoFor 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 7y agoFWIW, 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.
- cheesysam 7y agobrew install https://raw.githubusercontent.com/Homebrew/homebrew-core/4e60ba14762ad17eef498ce5719aa06bc639d2b1/Formula/pastel.rb
- otterpro 7y agoAnother great tool from sharkdp written in Rust (such as bat, hyperfine, diskus, fd, etc).