feat: Add from_hex_str methods to Color and RgbColor#332
Conversation
A color like `#abc` should be interpreted as equivalent to `#aabbcc`.
Converting from a 3-digit or 6-digit hex color is a common operation in various formats, including HTML/CSS, SVG, and Git. Add it to anstyle.
|
This is pushing further at the boundaries of The limited scope was for two reasons
The main impact I can see this having is more in the "well, you parse X, but what about Y". Beyond, the question is where do we draw the line? |
|
@epage I originally considered making this |
|
I understand that it would be nice for this to live someplace and there not being a clear home for it. However, after thinking on this more, As a stop gap, i would be fine having something like this in |
Converting from a 3-digit or 6-digit hex color is a common operation in various formats, including HTML/CSS, SVG, and Git. Add it to anstyle.
I've based this PR on #331, which fixes a bug in this logic.