Sign up ×
Graphic Design Stack Exchange is a question and answer site for Graphic Design professionals, students, and enthusiasts. It's 100% free, no registration required.

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
Semi-on-topic - Here is an online tool I just stumbled across that allows you to set increment shades of colors in hex code: Thought you might be interested as you're working in shades of the same color – John Apr 4 '13 at 18:00
thanks @John I can look at their source code. – Darth_Vader Apr 4 '13 at 18:16
HEX format colors are RGB in hexidecimal form: FFFFFF = FF FF FF = 255 255 255. So by your description, I would split the HEX into 3 pairs and calculate the difference. Your example does not appear to follow this, so I suspect that difference is being calculated via a different color model (HSB/HSV perhaps). – horatio Sep 5 '13 at 16:59

1 Answer 1

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.