From: Einar Jørgen Haraldseid Date: Tue, 3 Dec 2024 20:15:45 +0000 (+0100) Subject: La til en parser for å gjøre det enklere å scanne farger med Linshang LS171 X-Git-Url: https://git.slaskete.net/einar-bin/commitdiff_plain/0deae0c15a3724b2482160caabf868f842d5602d?hp=75ab68fc868e38c52ac87d5d6686e6985c6131d6 La til en parser for å gjøre det enklere å scanne farger med Linshang LS171 --- diff --git a/colorscan.sh b/colorscan.sh new file mode 100755 index 0000000..bcb9689 --- /dev/null +++ b/colorscan.sh @@ -0,0 +1,25 @@ +#!/bin/bash +n=1 +while read scan; do + if [ "${n}" != 1 ]; then + echo "" + fi + echo "Scan ${n}:" + lab=$(echo "${scan}" | jq -cr '.scan.lab | join(", ")') + lch=$(echo "${scan}" | jq -cr '.scan.lch | join(", ")') + rgb=$(echo "${scan}" | jq -cr '.scan.rgb | join(", ")') + r=$(echo "${rgb}" | cut -f 1 -d "," | tr -d " ") + g=$(echo "${rgb}" | cut -f 2 -d "," | tr -d " ") + b=$(echo "${rgb}" | cut -f 3 -d "," | tr -d " ") + rH=$(printf "%x\n" ${r}) + gH=$(printf "%x\n" ${g}) + bH=$(printf "%x\n" ${b}) + for i in {1..10}; do + echo -e "\033[48;2;${r};${g};${b}m \e[0m" + done + echo "L*a*b: ${lab}" + echo "L*C*h: ${lch}" + echo "RGB: ${rgb}" + echo "HEX: #${rH}${gH}${bH}" + ((n++)) +done < <(bluecolor --format json)