Support modern browser colors:
Hi!
I'm using this package via react-art. This PR adds support for modern browser colors directly on the core color module instead of via svg parse. It also adds a fall back color array, so that colors like "foo" will result in something black being rendered instead of an error.
Thanks!
These colors are mostly not very useful because designers generally come up with their own combinations and very few people make use of this list. I'm not sure it makes to add the weight of this list to the download for everyone if it is not going to be used a lot.
The preferred solution is to use a converter such as the one in the SVG parser here that converts it to the numeric value if you need it.
What's your use case for using strings?
@sebmarkbage I see your point about the weight trade off of adding a big list of strings. I was consuming your package via react-art and my goal was closer parity with modern browser svg support. I understand the argument for not adding these colors, but I think that support for transparent and none is pretty crucial. And I think a fallback to black for any other non-supported strings is also sensible. Would you like me to remove the additional colors from this PR and leave those fallback behaviors?