views:

87

answers:

3

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?

+1  A: 

That is just in the definition. We can only wonder why the definers defined it like that...

Jochem
A: 

Somebody just defined it like that. Makes no sense. If you want something even lighter though, use Silver ;)

sinni800
+8  A: 

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 is the case of "gray." In HTML, "gray" is specifically reserved for 127,127,127. However, in X11, "gray" was assigned to 190,190,190 (75%), which is close to HTML's "silver", and had "lightgray" at (211,211,211) and "darkgray" at (169,169,169) counterparts. This resulted in HTML's "gray", at 50%, actually being significantly darker than "darkgray", at 66%. The W3C also defined a color that is equal to X11's "green", but called it "lime".

It looks like the named colors in System.Drawing.Color match up with the W3C definitions.

Color.DarkGray = #FFA9A9A9

Color.Gray = #FF808080

Peter
The green tick is yours sir!
Benjol