Draft: Hex str or components
This is a better (but still non-functional) approach at using both component and hex-string colors.
I'm using a custom serde deserializer, unfortunatelly, it is not yet working. Leaving it here so maybe you have a better idea on how to proceed (i'm too tired to continue today).
Got my inspiration from:
- https://serde.rs/impl-deserializer.html
- https://serde.rs/deserialize-struct.html
- https://docs.serde.rs/serde/de/trait.Visitor.html
Errors we get
- We get an error when trying to parse a hex string:
invalid type: string \"#0000ffff\", expected RgbaComponents
- We get an error because, even if
RgbaComponets
knows (eventually) how to deserialize itself from a string, theColourDefinition
Enum can't match the String representation and it does not know to which enum variation this color matches.
Edited by Rodrigo Valin