Mobile app version of vmapp.org
Login or Join
Sent7350415

: Measure between two hex values I was curious to know if anyone has used or seen code to measure colors between two hex values. Any language will do but I did see the JavaScript source to

@Sent7350415

Posted in: #Color #Hex #Measurement

I was curious to know if anyone has used or seen code to measure colors between two hex values. Any language will do but I did see the JavaScript source to determine what HEX value is in RGB.

Example: between #44aaee and #0088ee would result in #2199ee

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Sent7350415

1 Comments

Sorted by latest first Latest Oldest Best

 

@Phylliss782

I use a shell script to handle it. I quickly type the alias to my script followed by the two colors in question (without the hash mark) and it spits out the result.

E_INVALID_ARGUMENTS=2;

usage()
{
echo -e "Usage: ${COLOR_BRIGHT_WHITE}$(basename [CO])${COLOR_END} color color"
exit
}

if [ -f "${HOME}/bin/colors" ]; then . "${HOME}/bin/colors"; fi
OPTIONS="ibase=16;obase=10;";

if [ -z "" ]; then usage $E_INVALID_ARGUMENTS; fi
if [ -z "" ]; then usage $E_INVALID_ARGUMENTS; fi

CA=$(echo "" | tr [:lower:] [:upper:]);
CB=$(echo "" | tr [:lower:] [:upper:]);

C1=$(echo "${OPTIONS}(${CA:0:2}+${CB:0:2})/2" | bc);
C2=$(echo "${OPTIONS}(${CA:2:2}+${CB:2:2})/2" | bc);
C3=$(echo "${OPTIONS}(${CA:4:2}+${CB:4:2})/2" | bc);

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme