summaryrefslogtreecommitdiff
path: root/bin/common/hextorgb
diff options
context:
space:
mode:
Diffstat (limited to 'bin/common/hextorgb')
-rwxr-xr-xbin/common/hextorgb7
1 files changed, 7 insertions, 0 deletions
diff --git a/bin/common/hextorgb b/bin/common/hextorgb
new file mode 100755
index 0000000..b268db5
--- /dev/null
+++ b/bin/common/hextorgb
@@ -0,0 +1,7 @@
+#!/usr/bin/env bash
+cat /dev/stdin \
+ | tr -d '#' | tr '[:lower:]' '[:upper:]' \
+ | sed -r 's/([0-9A-F]{2})/\1\n/g ; i ibase=16' \
+ | bc \
+ | tr '\n' ',' \
+ | sed 's/.$// ; s/.*/rgb(&)/'