Added conditionals
This commit is contained in:
@@ -7,10 +7,8 @@
|
||||
```sh
|
||||
hex_to_rgb() {
|
||||
# Usage: hex_to_rgb "#FFFFFF"
|
||||
((r=16#${1:1:2}))
|
||||
((g=16#${1:3:2}))
|
||||
((b=16#${1:5:6}))
|
||||
|
||||
: "${1/\#}"
|
||||
((r=16#${_:0:2},g=16#${_:2:2},b=16#${_:4:2}))
|
||||
printf '%s\n' "$r $g $b"
|
||||
}
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user