You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
347 B
Bash

#!/usr/bin/env bash
rgb () {
declare g
declare b
case ${#1} in
6) r=$"0x${1:0:2}"; g=$"0x${1:2:2}"; b=$"0x${1:4:2}";;
3) rgb "${1:0:1}${1:0:1}${1:1:1}${1:1:1}${1:2:1}${1:2:1}"
return;;
1) rgb "$1$1$1"; return;;
*) return 1;;
esac
#printf '\033[38;2;%i;%i;%im' $r $g $b
printf "%i;%i;%i\n" $r $g $b
}
rgb $*