parent
97b514f1fa
commit
60941bc007
1 changed files with 13 additions and 0 deletions
@ -0,0 +1,13 @@ |
||||
#!/bin/sh |
||||
# https://stackoverflow.com/questions/7253235/convert-hexadecimal-color-to-decimal-rgb-values-in-unix-shell-script/7253786#7253786 |
||||
hexinput="$(echo $1 | tr '[:lower:]' '[:upper:]')" # uppercase-ing |
||||
a=`echo $hexinput | cut -c-2` |
||||
b=`echo $hexinput | cut -c3-4` |
||||
c=`echo $hexinput | cut -c5-6` |
||||
|
||||
r=`echo "ibase=16; $a" | bc` |
||||
g=`echo "ibase=16; $b" | bc` |
||||
b=`echo "ibase=16; $c" | bc` |
||||
|
||||
echo $r $g $b |
||||
exit 0 |
Loading…
Reference in new issue