This is a tiny bash function to convert rgb (0-255,0-255,0-255) into hexadecimal (000000-FFFFFF).
hex() { bash -c """printf "%02X%02X%02X" $(echo $* | tr , \ )"""; }It can interpret a few different input styles:
hex 255 255 255 # FFFFFF
hex 255,255,255 # FF0000
hex "128 200 250" # 80C8FAJust drop the function in your ~/.bash_aliases (or .zshrc.local if you are using ZSH) and restart your terminal.
I've tested all this on macOS (darwin) and Debian/Ubuntu, without any issues.
This also works on iOS viaiSH(Alpine Linux). Windows... not so much.
MIT © 2021 Nicholas Berlette