Show HN: Sorted CSS Colors – Sort the named CSS colors in a nice way
enes.in
enes.in
I've created this tool last summer, but I hadn't shared it here back then. It's a PWA that I made with pure JS.
No. In this case there’s nothing earnest about the smiley face, which is why it makes the comment seem rude. Just like a genuine smile is different to Dolores Umbridge’s smile.
I read the comment as an attempt to redirect the person from begging to helping, in as nice a way as possible.
But if someone has a bone to pick with people who are rude about suggestions, they're going to read ill intent into the whole message, smiley or otherwise.
Edit: here you go https://pastebin.com/5Kypr4kh
Edit 2: I would, but I'm at work so personal GH is a no-go atm. I'll cycle back here EOD & make the PR if OP agrees w/ proposal
in other words: how can i just bunch more colors together?
But, serious question: does anyone actually use CSS colors except for a handful of the basics ("red", "blue") for prototyping/debugging?
I mean, the idea of typing "background-color: lightsalmon;" just feels so bizarre to me.
Whenever I've needed to come up with colors from scratch, I'll just start with an intuitive best guess -- e.g. "hsl(30, 80%, 50%)" -- and then iterate a couple times till I get what I'm looking for.
It seems like even more effort to try to select colors from the CSS palette when it might turn out that there isn't even a satisfactory one. The CSS colors are still extremely limited. E.g. the distance between neighbors like "dark cyan" and "darkslategray" is huge.
--text-color: cornsilk;
--background-color: peru;While I agree, I feel that learning to look at "#FFA07A" and immediately grok "pink" has been of general benefit to me as a frontend dev.
> or "hsl(17, 100%, 73.9%)" at a glance
I must admit though that I haven't mastered identifying hue by number just yet (though if I do, it will be even better as Saturation and Lightness/Luminosity are much easier to reason about).
0 = red
120 = green
240 = blue
Then you just interpolate as desired, so yellow is 60, orange is 30, red-orange is 15.
And really all you need to remember is red = 0 (lowest energy wavelength) and the three RGB primaries are spread evenly around the 360° color wheel, therefore 0, 120, 240.
But I hadn't spent the time to look at hue values, so your chart helped me get better at them.
This thread is about developers writing CSS...
People with vision disabilities can have a custom plugin that changes the colors based on their name, instead of trying to convert all the hex codes.
One would be better off using the results [1] of Heer & Stone (2012) [2] (or a similar analysis) to assign names to sRGB colors. You end up with 33 unique names instead of more than 100, and the number of unique names can be reduced further by merging synonyms.
[1] http://vis.stanford.edu/color-names/analyzer/ [2] https://doi.org/10.1145/2207676.2208547
That would seem like a... usability disaster.
Any accessibility tool for vision should operate at an OS level to map colors across everything. And even if you wanted a web-only tool, it would need to similarly operate across all colors -- whether hex codes or in images or SVG's. Very few sites use any named CSS colors at all except for "white" or "black".
There are lots of areas where it's important to keep accessibility in mind... but named CSS colors would not seem to be one of them.
Does this exist, or is this hypothetical? If it exists, it's something I would add to my toolkit.
It would make much more sense to do something check the lightness ratio between the foreground and background colors, and increase that ratio on the fly. Chrome can already tell you if the color ratio is too low to pass accessibility guidelines. There are a number of plugins that do this, like Color Enhancer [1] or High Contrast [2].
1. https://chrome.google.com/webstore/detail/color-enhancer/ipk...? 2. https://chrome.google.com/webstore/detail/high-contrast/djcf...
That's what I do too, but I find it leads me to get stuck in a rut with certain color areas. Looking at this site was a good reminder to me to give named colors a try just because it will help me break out of my usual color habits.
Nonetheless, I kept using them for a while, because I think it makes the css easier to read, when having names (even suboptimal ones) over hex codes.
But with the introduction of css preprocessors in the late 2000s that allow defining variables, I have not used them since.
That said where is my UV value?
the best example i can think of is this fire demo on codepen, which i bookmarked because i really liked the color names: https://codepen.io/jscottsmith/pen/dwZjWK
Words in stead of numbers add a nice touch
Those who treat it as craft and an art
May find that named colors are a good start.
Or red or lightsalmon or yew
Remember that if life is rough
Just add in a little more peachpuff!
that you could use something like LESS,
to substitute code arbitrarily,
for the readable name that's there really.
Someone else's code munge my code
Decreasing its readability for others
And possibly introducing unforeseeen issues
Only to save a few bytes here and there
.notice {
padding: 1em;
border: 1px solid black;
margin-bottom: 1em;
}
.notice.warning {
background-color: peachpuff;
border-color: red;
}
.notice.success {
background-color: green;
border-color: lightgreen;
}
I think the end-result is pretty nice.https://github.com/runarberg/random-go-stone-placements/blob...
"Burn sienna" seems even more varied. Here's are four different color-oriented websites, with a dark earthy orange from Colorlex [1], a light salmon from Canva [2], a light brown from Benjamin Moore [3] and a dark brown from Atelieracrylic [4].
1. https://colourlex.com/project/burnt-sienna/ 2. https://www.canva.com/colors/color-meanings/burnt-sienna/ 3. https://www.benjaminmoore.com/en-us/color-overview/find-your... 4. http://atelieracrylic.com/atelier-interactive/burnt-sienna/
white-space: nowrap
So they take a word "whitespace" which needs no hyphen and jam one in. Then they take two completely distinct words "no wrap" and jam them together with no separator. And then you have to remember both of these on the same rule.- The XML W3C Rec: https://www.w3.org/TR/xml/
- The HTTP 1.0 RFC: https://tools.ietf.org/html/rfc1945
However, there are exception. The Unicode character database has a property called "White_Space" which implies it is two words: http://www.unicode.org/reports/tr44/#White_Space
<tongue-in-cheek> Except that `_` is a "word" character by default. </tongue-in-cheek>
Oh, and don't forget that there is in fact a word-wrap property, which is a much better name for the previous behavior, but in fact only customizes how the line-breaking algorithm determines which words can be broken apart.
[0]: https://stackoverflow.com/questions/8318911/why-does-html-th...
Know that CSS colors mostly came from X11: https://en.m.wikipedia.org/wiki/X11_color_names
The CSS team shares some blame, though: they adopted them (and they really didn't need to: they could have just supported rgb/hsb/lab triplets).
Don't remember which one I used, but do remember that I went home early that day after that :/
https://en.wikipedia.org/wiki/X11_color_names#Clashes_betwee...
Turns out there are 16 HTML colors (upped to a whoppin' 17 colors in HTML4/CSS2.1) and around 124 named colors which originally came in due to X11. Since then, several colors have been added through various standards updates for a total of around 147 colors.
I'm not aware of an equivalent tool for Pantone colors. But it can be created using this very tool with a table of pantone colors instead of a table of named css colors that it uses now.
There is a tool, but I've only seen it in a dead tree edition.
One thing I noticed is that some colors appear brighter, but are further down on the Saturation scale. For example, mediumturquoise and turquoise are shown as being less saturated than cyan, though cyan doesn't mix in any gray. Are these sorted by the sums of their RGB values? I'm also not too well versed in color theory, so I could be missing or misunderstanding something too.
I think there's a misunderstanding there. Mediumturquoise and turquoise are both located above cyan, which means they are brighter as the vertical axis is the lightness.
Also, to answer your question, colors are sorted by their hue, saturation and lightness values. So, it's actually a 3D color visualizer, where one dimension (hue) is reduced into just a slider at the top, and the other two dimensions are represented in a 2D grid.
Thanks for your comment!
The only "bug" I see, if at all, is that the hue value does not wrap around, i.e. the colors shown at 360 are not the same colors shown at 0.
Especially during prototyping/design, it's soooo much easier to keep your designs consistent with a named look-alike color, then switch over to brand colors with a find/replace.
For personal projects, I almost exclusively use named colors.
Some thoughts:
1. In grayscale mode the slider doesn't appear to do anything
2. Have you considered adding a way to compare colors or find complimentary?
3. A simple search box that accepted any css color format would be useful
My answers to your points:
1. True. Maybe I could make it also disabled to restrict interacting with it altogether.
2. I didn't design the tool as a more serious colorpicker or color scheme generator, so I wasn't thinking about adding more advanced features.
3. I thought about adding a search box that would accept many possible color values as input, but I feel like, adding anything will make the design more cluttered at this point. So, for me, adding stuff is more of a design challenge than a technical one.
I find that I use hex for properly designed colours and otherwise use like one of 15 named colours for devel placeholders.
Turns out there's like... 100.
Are they special? Or did someone just pick and give them names?
It is cool to get 5 matching colors but I'm a dope for design, so I have no idea how to work with that.
Interestingly the difference between some of these colours is (to my eyes / monitor) ... very little?
E.g. chartreuse and lawngreen, palegreen and lightgreen, mediumturquoise and darkturquoise, etc.
Or at least adults are, possibly because of the environment they grew up in (the science is still murky on that one).
I took a test a while back and discovered that I'm apparently the color equivalent of a super-taster. I have extremely fine color perception.
In the examples you list, lawngreen looks darker, bluer and a little more saturated than chartreuse. Palegreen is much lighter than lightgreen and somewhat more saturated. Mediumturquoise is bluer, darker, and duller than darkturquoise's greenish tint.
Note, of course, that your monitor and viewing environment will affect your perception too.
1: https://drafts.csswg.org/css-color-3/#peru
2: https://en.wikipedia.org/wiki/Eric_A._Meyer#Personal_life
3: https://lists.w3.org/Archives/Public/www-style/2014Jun/0312....
Yeah? Well … you know, that's just, like, your opinion, man. More specifically, HSL's opinion. HSL is a fine colour space for specifying CSS colours, but not so good for evaluating lightness.
If I use HSLuv instead, which is supposed to be like HSL, but more human-perceptually uniform and sane (basically a neat compromise between CIE Luv/Lab and standard HSL), I get a lightness of 61.2 for cadetblue and 91.1 for cyan.
My bog-standard image editor uses HSB (a.k.a. HSV) in the HSL-style mode of its colour picker (HSL isn't even an option); and if I measure cadetblue with that via the ‘eyedropper’ tool, I get a brightness of 63%, whereas cyan has 100%.
Those are obviously way closer to the truth when you just, like, look at the colours — it's totally plausible that cyan is about 50% brighter; “lightness values are almost same” is not plausible.
This discrepancy isn't a huge problem, because the main dimension by which this tool organises colours is hue, which HSL is OK at. Only the way in which colours with similar hue are laid out on the page is off. It would be nice to see a more appropriate colour space used for this purpose.
Also, nice project :)
Are you using CIE* colorspace to match?
Are named CSS colors seeing any practical use?
I think /r/InternetIsBeautiful/ may like this.
Usefull, though. Thank you for posting this.