linebender / color

Color in Rust.
Apache License 2.0
39 stars 5 forks source link

Add a color parse function consuming a string prefix #69

Open tomcur opened 2 days ago

tomcur commented 2 days ago

The unparsed remainder of the string is indicated in the return value.

Resolves #60.

The existing function parse_color now returns ParseError::ExpectedEndOfString if there are trailing characters. Some choices could be made differently:

tomcur commented 22 hours ago

We should link to the relevant spec sections, especially regarding the handling of trailing items after #rrggbbaa.

I'm not aware of an authoritative source on this, it's possible one exists, or perhaps there's prior art we can follow.

DJMcNab commented 22 hours ago

Hmm. I presumed that the css specs would specify this. I can't imagine that e.g. border: #ffff00ff10px solid would be valid for a 10 pixel border. Although admittedly, I've not tried it.