✏️ Rgba not yet supported
This commit is contained in:
parent
c3d50af36e
commit
28df98eaa4
1 changed files with 4 additions and 4 deletions
|
|
@ -32,7 +32,7 @@ EOM
|
||||||
hex_to_rgb() {
|
hex_to_rgb() {
|
||||||
: "${1/\#/}"
|
: "${1/\#/}"
|
||||||
((r = 16#${_:0:2}, g = 16#${_:2:2}, b = 16#${_:4:2}))
|
((r = 16#${_:0:2}, g = 16#${_:2:2}, b = 16#${_:4:2}))
|
||||||
printf '%s\n' "rgba($r, $g, $b)"
|
printf '%s\n' "rgb($r, $g, $b)"
|
||||||
}
|
}
|
||||||
|
|
||||||
rgb_to_hex() {
|
rgb_to_hex() {
|
||||||
|
|
@ -64,12 +64,12 @@ main() {
|
||||||
while getopts ":x:r:?" arg; do
|
while getopts ":x:r:?" arg; do
|
||||||
case $arg in
|
case $arg in
|
||||||
x)
|
x)
|
||||||
rgbaval=$(hex_to_rgb "${2:-''}")
|
rgbval=$(hex_to_rgb "${2:-''}")
|
||||||
printf "%s\n" "$rgbaval"
|
printf "%s\n" "$rgbval"
|
||||||
read -e -r -p "save code to clipboard?(y/n): " clipit
|
read -e -r -p "save code to clipboard?(y/n): " clipit
|
||||||
if [[ "$clipit" == "yes" || "$clipit" == "y" ]]; then
|
if [[ "$clipit" == "yes" || "$clipit" == "y" ]]; then
|
||||||
dependencycheck xclip
|
dependencycheck xclip
|
||||||
printf "%s" "$rgbaval" | xclip -sel clip
|
printf "%s" "$rgbval" | xclip -sel clip
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
r)
|
r)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue