From e061f9c4fd5f25a8bf1df1661aea51ffdde0db6d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Einar=20J=C3=B8rgen=20Haraldseid?= Date: Wed, 1 Jan 2025 16:28:18 +0100 Subject: [PATCH] =?utf8?q?Husk=20zeropad=20p=C3=A5=20hex-verdier?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- colorscan.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/colorscan.sh b/colorscan.sh index bcb9689..c57872a 100755 --- a/colorscan.sh +++ b/colorscan.sh @@ -11,9 +11,9 @@ while read scan; do 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}) + rH=$(printf "%02x\n" ${r}) + gH=$(printf "%02x\n" ${g}) + bH=$(printf "%02x\n" ${b}) for i in {1..10}; do echo -e "\033[48;2;${r};${g};${b}m \e[0m" done -- 2.30.2