Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WPF color definitions confusion

Tags:

c#

colors

wpf

Why is in WPF the color "Gray" darker then the color "DarkGray". My logic says that "DarkGray" shoud be darker.

Should it not be LightGray, Gray, Darkgray?

like image 262
user853710 Avatar asked Oct 17 '25 10:10

user853710


2 Answers

These color names actually come from the CSS Color Module Level 3 W3C Recommendation and the strange definition of Gray and Dark gray actually comes from merging the X11 and web standards. To quote wikipedia:

Perhaps most unusual of the color clashes between X11 and W3C is the case of Gray. In HTML, Gray is specifically reserved for the 128 triplet, i.e. 50% gray. However, in X11, ‘gray’ was assigned to the 190 triplet, i.e. 75%, which is close to W3C ‘Silver’, and had ‘Light Gray’ at 211 and ‘Dark Gray’ at 169 counterparts. This resulted in W3C’s ‘Gray’, at 50%, actually being significantly darker than ‘Dark Gray’, at 66%.

like image 101
dsfgsho Avatar answered Oct 18 '25 22:10

dsfgsho


While I agree that the naming suggests that Colors.DarkGray would be darker than Colors.Gray, DarkGray is defined and documented to be #FFA9A9A9, and Gray is defined to be #FF808080 (which is darker).

That being said, you can define any color you wish, and not use the predefined system colors.

like image 22
Reed Copsey Avatar answered Oct 18 '25 22:10

Reed Copsey



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!