Added conditionals

This commit is contained in:
Dylan Araps
2018-06-23 10:34:10 +10:00
parent 809c8b5a03
commit c4a203bb40
2 changed files with 70 additions and 5 deletions

View File

@@ -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"
}
```