-
Notifications
You must be signed in to change notification settings - Fork 660
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Convert RGB to the closest representation with name #2813
Comments
No, not at all. They are a historical and somewhat random set, not in the slightest evenly distributed. |
You mean, keeping the names but changing the colors they represent? No, that would not be web compatible at all. Also, even spacing in RGB space is not the same as evenly spaced visually. |
If RFC 7986 is not finalized yet, perhaps you could recommend that they accept a more flexible color definition, such as hex code. As @svgeesus notes, the named colors in CSS do not represent any kind of consistent color system, and there are many regions of the RGB cube (or any other color space) which aren't well represented. Otherwise, your best approach for a usable UI might be to create a subset of the named colors which represent an attractive and well-balanced palette. But of course, for interoperability, you'd still need to support the full set of names. |
If anyone looking for more, this humorous presentation will tell you more than you ever wanted to know: http://christopher.org/history-web-color-names/ |
The RFC is finalized, but I am going to propose errata to it: https://www.ietf.org/mail-archive/web/calsify/current/msg03048.html |
Yes, please, using the CSS color names is a terrible idea and I strongly recommend against spreading those any farther than absolutely necessary. |
Closing as issue is against RFC 7986 and original poster has filed issue against that specification. |
RFC 7986 New Properties for iCalendar introduces a COLOR property and according to my reading the value can only be a color name, hence no RGB.
A possible UI would be, rathat than offering a mega big box of distinct possible colorus, to let the user choose any RGB colour and then convert the choice to the nearest colour that has text representation.
The question is how to calculate the nearest RGB with a text representation to a given RGB.
At first I thought that the colours listed at https://drafts.csswg.org/css-color/#named-colors have equal distance, so it is just a matter of converting each color component to the closest value that can be divided by e.g. 8. But the list contains only two values starting with #3:
limegreen #32CD32 | 50 205 50
mediumseagreen | #3CB371 | 60 179 113
but with #2 more colours start:
darkslategray | #2F4F4F | 47 79 79
forestgreen | #228B22 | 34 139 34
lightseagreen | #20B2AA | 32 178 170
seagreen | #2E8B57 | 46 139 87
So the jumps in the colours are not normed.
Isn't it better to adjust the text representations for have equal distances between each other? E.g. each R-G-B component can have distinct values: 0, 4, 8, C or alike?
What would be the current procedure to convert arbitraty RGB to the closest colour representable as text?
The text was updated successfully, but these errors were encountered: