[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Default colors vs. gamma

From: Alexander Malmberg
Subject: Re: Default colors vs. gamma
Date: Wed, 13 Oct 2004 01:37:21 +0200
User-agent: Mozilla Thunderbird 0.8 (X11/20040918)

Pascal Bourguignon wrote:
And for gamma-newbies around here like me, why should the gamma be 1.6
rather than 1.0?  Why shouldn't we keep 'absolute' values for colors
(gamma=1.0) everywhere?

Well, I'm no expert on this, but as I understand it:

We really want to use linear colors; ie. when we say that the system gray is 0.667 gray, we want a color that is two-thirds of the light intensity of full white. The problem is that if we give a signal to the monitor that is two-thirds of the signal for full-white, various non-linear phenomenon in the monitor will cause the resulting color to be 0.667^gamma times the intensity of full white.

The 'gamma' in this function depends on all kinds of things (monitor, monitor settings, ambient light, etc.), but it's usually somewhere around 2.0. Thus, using 2.0, our 0.667 gray will turn out as 0.667^2.0 ~= 0.44, less than half the intensity of full white. (Note that brightness and contrast controls on a monitor can't fix this. They can change how bright black is, and how bright white is, but they can't change the ratio of intermediate colors to full white/black.)

To compensate for this, you do various gamma adjustments. A nice and simple approach is to make the video card do it. If we know that the effective gamma of our monitor is, say, 2.0, we can have the video card apply an inverse transform when it reads the framebuffer and sends the signal to the monitor (this is what 'xgamma' does). The video card will then read 0.667 from the framebuffer, apply the inverse transform, and really send 0.667^(1/2.0) ~= 0.82 to the monitor. In the monitor the 0.82 ends up as 0.82^2.0 ~= 0.67, which is just what we wanted.

Since most users haven't told X to do this, other desktop environments make their colors brighter than they "should" be so that they'll look right on these systems. This is what my patch does. Instead of making our gray 0.667, it changes this to 0.667^(1/1.6) ~= 0.78, so that's what we'll write to the framebuffers. If the video card isn't doing any adjustments, it will send 0.78 to the monitor. which is pretty close to what we want.

1.6 is just a reasonable guess; it probably isn't the right gamma, but it'll be a lot closer than 1.0 (unless the user did the right adjustments, in which case it'll be all wrong).

(According to people in #GNUstep, GNOME, KDE, and Windows have their default interface colors set pre-adjusted for a 1.6 gamma, but they do not otherwise adjust colors.)

I was asked in #GNUstep to provide screenshots of this, so:


The right instance of TextEdit is without my patch (or with my patch, but with the default set to 1.0). The left instance is with my patch and the default settings (ie. colors adjusted for a 1.6 gamma). Thus, the right instance is using linear colors and should look "correct" on displays that are gamma adjusted, while the left instance should look "correct" on unadjusted displays. (When displaying the image, be wary of programs that do their own adjustments.)

After looking at the mails and #GNUstep discussion, I get this list (if I misplaced or forgot someone, please correct me):

Dennis Leeuw
Fred Kiefer
Gürkan Sengün
(_maybe_ Adam Fedor, not sure how to read that mail)

Nicolas Roard
Alex Perez [1]
Jeff Teunissen
Riccardo Mottola

Which doesn't really get us anywhere, except that it's now late and I need to sleep. :)

[1] After discussion in #GNUstep, it turned out that Alex's earlier mails here were based on a misunderstanding of what the patch did.

- Alexander Malmberg

reply via email to

[Prev in Thread] Current Thread [Next in Thread]