Graphic Design Stack Exchange is a question and answer site for Graphic Design professionals, students, and enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

enter image description here

share|improve this question
up vote 1 down vote accepted

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.


  echo -e "Usage: ${COLOR_BRIGHT_WHITE}$(basename $0)${COLOR_END} color color"
  exit $1

if [ -f "${HOME}/bin/colors" ]; then . "${HOME}/bin/colors"; fi

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

CA=$(echo "$1" | tr [:lower:] [:upper:]);
CB=$(echo "$2" | 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);
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.