Why is DarkGray lighter than Gray?

31,516

Solution 1

Wikipedia has some information on the subject. It sounds like a lot of the named color definitions come from X Windows System. On X, "Gray" is actually closer to "Silver". However, the W3C defined Gray (more appropriately?) as RGB 50%.

Here's some more Wikipedia on the subject:

Perhaps most unusual of the color clashes between X11 and W3C is the case of "Gray" and its variants. In HTML, "Gray" is specifically reserved for the 128 triplet (50% gray). However, in X11, "gray" was assigned to the 190 triplet (74.5%), which is close to W3C "Silver" at 192 (75.3%), and had "Light Gray" at 211 (83%) and "Dark Gray" at 169 (66%) counterparts. As a result, the combined CSS 3.0 color list that prevails on the web today produces "Dark Gray" as a significantly lighter tone than plain "Gray", because "Dark Gray" was descended from X11 – for it did not exist in HTML nor CSS level 1 – while "Gray" was descended from HTML. Even in the current draft for CSS 4.0, dark gray continues to be a lighter shade than gray.

W3C color keywords:

DimGray    '#696969'  (105,105,105)  
Gray       '#808080'  (128,128,128)
DarkGray   '#A9A9A9'  (169,169,169)  //equal to X11 DarkGray
Silver     '#C0C0C0'  (192,192,192)  //close to X11 Gray (190,190,190)
LightGray  '#D3D3D3'  (211,211,211)  //equal to X11 LightGray
Gainsboro  '#DCDCDC'  (220,220,220)

Solution 2

W3C Grays
Nine assigned names where the R, G, and B values are numerically equal:

enter image description here

Solution 3

I would like to quote Tim Sneath's discussion regarding that,

These colours don't actually originate in HTML` - they date still further back than that to the X Window System that originated on UNIX systems. The HTML specification defines sixteen named colours that map onto the basic sixteen colours present in the EGA palette, but the earliest browsers such as Mosaic also supported any of the other X11 named colours, based on their colour representation as defined on X. Unfortunately, some of the original sixteen named colours have different representations to the X11 equivalents, for example Green is represented in X11 in this colour, whereas in HTML it's represented in this colour. The unfortunate result is that Gray is defined as #808080 in HTML, but DarkGray is represented as #A9A9A9, meaning that they're the wrong way around. Since WPF allows the same named colours as HTML for compatibility, the result is that the same idiosyncrasies carry forward. (You can find more information on the full set of X11 colour names and their representations in Wikipedia).

That's why the author also states that it is better to use the hex or scRGB to represent colors.

My recommendation therefore is in general to use the hex or scRGB colour representations wherever possible, or you might be surprised by the colours that you pick not matching your expectations!

Share:
31,516

Related videos on Youtube

tina Miller
Author by

tina Miller

Saved from the web by a job in industry. Coding GUI for computer-aided railway realignment machinery. At last a job where I have time to do stuff properly and don't have to worry about loads of unfixed bugs coming back to haunt me.

Updated on August 10, 2020

Comments

  • tina Miller
    tina Miller over 2 years

    Simple curiosity here, tinged with some practical concerns because I get caught out by this occasionally.

    How come Color.DarkGray is lighter than Color.Gray?

    • leppie
      leppie about 12 years
      When you want a DarkGray, choose DimGray :)
    • Neil B
      Neil B over 3 years
      Sounds like a gray area to me. ;)
  • user
    user about 8 years
    "gray" is not 127,127,127, it is 128,128,128. Maybe update Wikipedia quote?
  • David
    David over 6 years
    A simple trick i tend to use when i cant find the right shade is to just use: #222 (very dark) #333 (dark) #444 (medium) etc.. I find it almost as distictive as 1, 2, 3
  • user1703401
    user1703401 over 4 years
    Display hardware was different in the olden days, the days when they picked "Gray" and spent a lot of money. SGI was a dominant force back then, their displays were gamma corrected. Current consumer-grade hardware is not, that is why #808080 looks so dark. Obligatory wikipedia link.
  • Storm Muller
    Storm Muller over 4 years
    What's the first color though?
  • Glenn Slayden
    Glenn Slayden over 4 years
    @StormMuller Black 0 0 0
  • Rémi Rousselet
    Rémi Rousselet about 3 years
    But if darkgray is a darker silver, why isn't it named darksilver?
  • Mr. Squirrel.Downy
    Mr. Squirrel.Downy over 1 year
    @StormMuller I guess you asked on purpose. Of course the text of first cell should be white (LOL

Related