Because of what dark gray is lighter than gray in CSS

Original author: Casper Beyer
  • Transfer

You probably have never paid attention to such a trifle, but your browser has predefined colors that are not what they seem. If I told you that the names of the patterns above are LightGray , Gray and DarkGray , which color would you match each name to?

I admit, it was a trick question, but why is dark gray still a lighter shade of just gray?

It all boils down to a small historical turmoil. The first versions of Mosaic and Netscape Navigator were X Applications, meaning they used the UNIX X Window System, which defines the set of normalized color names inherited by browsers.

Later, when the World Wide Web Consortium (W3C) switched to standardization, it consumed the X11 color set, but there were some conflicts with what the specification wanted.

In HTML, the color “Gray” was reserved for the triplet 128 (50% shade of gray), while X11 defined “Gray” as a shade of gray of about 75%, which meant that since the name was already taken, “Gray” became 50% gray, discarding the original X11 value.

On the other hand, the “DarkGray” color was not touched, since at that time it did not exist in HTML or CSS, which means that it was transferred without changes from X11, where it is defined as 66% shade of gray.

Ultimately, the combined CSS color list that prevails on the Internet today displays “DarkGray” noticeably lighter than “Gray” because “DarkGray” came from X11 and “Gray” came from HTML.

Even today in the latest version of CSS, the color “DarkGray” is a lighter shade than “Gray”, and also, as a result of naming difficulties, both “Gray” and “Gray” are valid names.

Also popular now: