Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I have two colors in LAB color space, for example:

blue: 32.303, 79.197, -107.864 (hex code: #0000ff)
yellow: 97.138, -21.556, 94.482 (hex code: #ffff00)

I want to mix these two colors, and get the result color (hopefully some green in this case). Any ideas how to accomplish this?

More about LAB color space:

  1. http://www.colourphil.co.uk/lab_lch_colour_space.html
  2. http://www.broadhurst-family.co.uk/lefteye/MainPages/Lab.htm
  3. http://en.wikipedia.org/wiki/Lab_color_space
share|improve this question
The coloring flag is for graph colourings. The tag descriptions are displayed in the tag selection interface, so you can use them to decide which tags are appropriate. –  joriki Feb 12 '13 at 9:09
Ok, thank you for pointing this out. –  Tamás Pap Feb 12 '13 at 9:12
Similar question of mine on SO: stackoverflow.com/questions/1351442/… –  tomp Apr 21 at 11:52

2 Answers 2

I assume you are writing a computer implementation.

LAB is device independent. Your color codes are not, as they will be processed both by software and hardware before you see the colors. As a first approximation, convert your RGB to sRGB, which in this case will act as a reference device-independent color space.

When the sRGB values are obtained, convert to CIEXYZ and then to LAB, as the Wikipedia article on LAB suggests. Thus, write a function to compute $rgb\rightarrow sRGB \rightarrow XYZ \rightarrow L*a*b*$. Once the latter is obtained, you can interpolate linearly, e.g., take the average values of each value, and then perform the inverse transform to get your new RGB codes.

share|improve this answer
Thank you for your answer. This is what I just finished implementing. It works good for mixing red with yellow (resulting in orange), but mixing blue with yellow results in a kind of purple. It should be a kind of green, if I'm correct.. –  Tamás Pap Feb 12 '13 at 9:30

Simen's answer won't work for yellow and blue mixing.

There are two types of mixing of colors: mixing light and mixing pigments. When you are mixing light, then adding something will make it brighter. When you are mixing pigments, you are taking light out... making it darker.

Hence the confusion. On a computer monitor, yellow (255R, 255G, 0B) plus blue (0, 0, 255) is equal to white. If you do some sort of average, you get gray. With pigments, you get green, of course.

Simulating what the pigments do is very difficult. You need to convert to reflectance and form a product, red with red, green with green, and blue with blue. Even that won't work as you expect, but it will highlight the fact that a mixture of pure yellow pigment and pure blue pigment will give you black, and not green.

To make it work out, you need to start with the correct pigments. Cyan (0, 255, 255) mixed with yellow (255, 0, 0) gives you green when you multiply.

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.