This is related to a question I asked on tex.stackexchange, which has a color aspect. The result of that question is the following image:
value and saturation contrast

I have drawn a series of gray squares on the left, with a red branch departing to the right. The goal is to have different red squares with a different saturation, but all with the same gray value. In the hsv color model, they all have the same v, but when I convert the image to grayscale using Gimp, they are not converted to the same gray. Also the visual impression is that the red squares on the right are darker than those on the left.

How can I, given a certain gray, calculate colors with a certain hue and the same gray value (or, even better, with the same gray impression)? The colors used in the image are all calculated, so I prefer solutions that incorporate calculations as well.

I might have used wrong terms here - I'm a mechanical engineer, so please correct me where appropriate, or ask for clarification.

The suggestion to use the Lab color space has led me to some conclusions:

  • I can use the Lab model's L value to set some kind of gray value for different colors. In the hsv model this is v. I'm not sure if I am actually allowed to compare those, but I'll do it until someone complains.

  • In the hsv model I can also set some "base color" (a hue), which I can't find in the Lab model.

  • In the hsv model, I have 2 constants (in the image above: h = 0, v = 0.375) and one variable (s).

  • Up to this point, I only have one constant in the Lab model. That is not enough to generate something similar to what I already made with the hsv model.

I guess it's time for experiments.

Done! After I got the conversion code running, it was wuite easy. The first step was to define the "target red" on the right. I calculated RGB2Lab(255,0,0) and changed the L value of the result to the desired L in the figure (L = 62.5). The colors are calculated using a linear interpolation in Lab space from (L,0,0) to (L,aTarget,bTarget). The result:

enter image description here

Thank you!

  • 2
    There is a ton of stuff which you may find usefull in the wikipedia entry, but I found ( en.wikipedia.org/wiki/HSL_and_HSV#Disadvantages ) of possible bearing on your problem, specifically: "Because HSL and HSV are defined purely with reference to some RGB space, they are not absolute color spaces: to specify a color precisely requires reporting not only HSL or HSV values, but also the characteristics of the RGB space they are based on, including the gamma correction in use."
    – horatio
    May 24, 2011 at 14:06
  • So the obvious idea is to specify the gamma and RGB color space (if possible!) when attempting a conversion.
    – horatio
    May 24, 2011 at 14:07
  • 2
    Even better idea is RGB → L*a*b* → RGB; as Lab is designed to approximate human vision and Lightness is one of its dimensions. May 24, 2011 at 14:28
  • @koiyu Lab is how I suggest gray matches be found too. (You beat me to it! I was mocking up the answer below when you posted this.)
    – Nick
    May 24, 2011 at 14:57
  • I was avoiding the problematic discussion of color perception :)
    – horatio
    May 24, 2011 at 15:03

2 Answers 2


You could use Lab colour space to find your matches. Colours with the same L value as your target gray will look nearly identical when converted to grayscale.

For example, a Lab gray of (50, 0, 0), will look very similar to the Lab reds (50, 30, 0), (50, 50, 30), and (50, 50, 50) when converted to grayscale. Samples below use Photoshop (Image > Mode > Grayscale) to convert from Lab to gray: Original Lab colours
Converted to grayscale

  • That looks like something I want! Thank you. However, I cannot use Lab directly with my toolset, so I need some kind of conversion algorithm. Koiyu suggested to convert RGB -> Lab -> RGB, and I'll try to implement that.
    – Christoph
    May 24, 2011 at 17:02
  • 1
    I found the following: http://www.brucelindbloom.com/index.html?Equations.html. I don't know if the conversions are correct and I have the impression that some magic is still required.
    – Christoph
    May 24, 2011 at 17:11
  • These conversion functions look like they might be useful.
    – Nick
    May 24, 2011 at 18:44
  • And they indeed look a little bit more straight forward...
    – Christoph
    May 24, 2011 at 21:32
  • @Nick I can do all calculations with a calculator, which is good. However, I have to implement the color model conversions in my LaTeX document, which is giving me a headache here and there. When it's done, I'll post the result and accept your answer.
    – Christoph
    May 26, 2011 at 8:32

So, the above advice from Nick only works for 50% Luminance. If you apply any other L value same to different colors, the gray result is different.

There must be a math for that, but you can do it on-screen by-eye.

If you create all the colors you want and then lay a gray element (illustrator) or layer (photoshop) with its transparency mode to "color" (or saturation or hue), that'll make all the elements below to reveal its luminosity.

You should make sure all the colors below that gray element have a saturation of 100, or you'll have gray-ish results, rather than nice colors.

Now, the problem is: With all the methods above, you'll make all the elements the "same luminosity inside the used RGB profile", i.e. same gray for the selected "device", and the worst part: The eye is a device, and there are differences.

You can show the same colors to different people and they will not find the same "evenness" as others.

Add that to the fact that you are setting those colors as "same luminosity" in the selected device, and not only are they all "estimated", as soon as you show it in a different device, the effect will fail, because every device has its own ability to light the red green or blue elements with different intensities, so you could be getting, e.g. red-er elements.

Also, if you make a blend from a gray to a color as above suggested, you have to make sure the gray element has at least 1/255 minimum in every channel (i.e. not longer gray) or the software will consider the origin gray as 0-hue, which will give you red-ish middle tones (because a blend between 0 hue and any other color will be half-way towards a red)

I'm a pre-press expert since '90s and my advice is: if you are going to go with the math, you should use the math for the eye (visual capabilities) as well as the ones for the device you will be showing those numbers on.

Good luck.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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