📜 ⬆️ ⬇️

Because of which dark gray is lighter than gray in CSS


You probably never paid attention to such a trifle, but in your browser there are 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 assign to each name?



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


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


Later, when the World Wide Web Consortium (W3C) moved on to standardization, it swallowed up the X11 color set, but it was not without conflicts with what the specification wanted.


In HTML, the color “Gray” was reserved for a triplet of 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, dropping the original X11 value.


On the other hand, nobody touched the color “DarkGray”, because it did not exist in HTML or CSS at that time, which means that it was transferred unchanged from X11, which is defined as 66% gray tint.


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


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


')

Source: https://habr.com/ru/post/455784/


All Articles