dotfiles

configuration files
git clone https://pi.duncano.de/git/dotfiles.git
Log | Files | Refs | README

commit 297e98d72661b0f895dfc65342cfed3ff780a183
parent 5eafdce461abbc8f1d34fd0d530c08bb883b5bc1
Author: Duncaen <mail@duncano.de>
Date:   Mon, 13 Feb 2017 01:35:56 +0100

bin: add hex2rgb and rgb2hex

Diffstat:
bin/hex2rgb | 9+++++++++
bin/rgb2hex | 3+++
2 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/bin/hex2rgb b/bin/hex2rgb @@ -0,0 +1,9 @@ +#!/bin/sh +# hex2rgb [hex ...] - converts hex colors to rgb +for x; do + case "$x" in \#*) x=${x#*#};; esac + a=$(echo "$x" | cut -c-2) + b=$(echo "$x" | cut -c3-4) + c=$(echo "$x" | cut -c5-6) + printf "%d %d %d\n" "0x$a" "0x$b" "0x$c" +done diff --git a/bin/rgb2hex b/bin/rgb2hex @@ -0,0 +1,3 @@ +#!/bin/sh +# rgb2hex red green blue - converts rgb to hex colors +printf "#%02x%02x%02x\n" $@