From 0deae0c15a3724b2482160caabf868f842d5602d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Einar=20J=C3=B8rgen=20Haraldseid?= Date: Tue, 3 Dec 2024 21:15:45 +0100 Subject: [PATCH 1/1] =?utf8?q?La=20til=20en=20parser=20for=20=C3=A5=20gj?= =?utf8?q?=C3=B8re=20det=20enklere=20=C3=A5=20scanne=20farger=20med=20Lins?= =?utf8?q?hang=20LS171?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- colorscan.sh | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100755 colorscan.sh 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) -- 2.30.2