#!/bin/sh sp(){ r=$(eval "echo \${c${i}:0:2}") g=$(eval "echo \${c${i}:2:2}") b=$(eval "echo \${c${i}:4:2}") printf "\e[38;2;$(h ${r:-0});$(h ${g:-0});$(h ${b:-0})m%s\e[0m" "$1" } h(){ echo "16i$1p"|dc;} i=0 while :;do eval c$i=$(echo $1 |tr -cd 0-9a-fA-F|tr a-f A-F) sp $(eval "echo '<#'\$c${i}") if [ $# -eq 0 ];then break;fi shift let i++ done while :;do sp '*>' if [ $i -eq 0 ];then break;fi let i-- done echo