: 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
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
More posts by @Sent7350415
1 Comments
Sorted by latest first Latest Oldest Best
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);
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.