-
-
Notifications
You must be signed in to change notification settings - Fork 377
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: use
to_string
to serialize Color (#934)
Since deserialize now uses `FromStr` to deserialize color, serializing `Color` RGB values, as well as index values, would produce an output that would no longer be able to be deserialized without causing an error. Color::Rgb will now be serialized as the hex representation of their value. For example, with serde_json, `Color::Rgb(255, 0, 255)` would be serialized as `"#FF00FF"` rather than `{"Rgb": [255, 0, 255]}`. Color::Indexed will now be serialized as just the string of the index. For example, with serde_json, `Color::Indexed(10)` would be serialized as `"10"` rather than `{"Indexed": 10}`. Other color variants remain the same.
- Loading branch information
1 parent
bf09234
commit 0a16496
Showing
1 changed file
with
128 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters