linebender / color

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

Impl `serde` for `DynamicColor` #70

Closed waywardmonkeys closed 4 days ago

waywardmonkeys commented 4 days ago

Using DynamicColor for color stops in Peniko will require this (when Peniko's serde feature is enabled).

waywardmonkeys commented 4 days ago

This is here so that things that enable serde in peniko will continue to work.

I don't think anyone should rely on serde remaining stable across breaking releases.

I'm also not really sure how great using serde on peniko (or color) would be ... just trying to keep the same set of things working.

DJMcNab commented 4 days ago

I'm also not really sure how great using serde on peniko (or color) would be ... just trying to keep the same set of things working.

This isn't really our vibe; that being said, I'm perfectly happy for us to be pragmatic. I think having this thread of discussion that we are making the tradeoff for efficiency of intentionally not thinking about it is perfectly reasonable.

waywardmonkeys commented 4 days ago

I mean that peniko currently has a serde feature (as does kurbo), but I don't really know how or if that's used out in the wild. I could ask @ratmice!

ratmice commented 3 days ago

I'm also not convinced that serde is the serialization format I want to use, My usage of serialization for peniko, is for a project which has never been released in the wild, I am flexible with regards to changing it's serialization.

Selvage does publicly turn the feature on, and it is used in the examples (serializing to a string buffer to show that it works), but that is about the extent of it. selvage example usage

Even then the usage of serialization is more for the purposes of code organization, keeping random shapes and their paint materials outside of the main code base, which is complicated enough without them.

Some of the issues with serde for peniko are described in https://github.com/linebender/peniko/issues/30 I would kind of like to try rkyv, but kurbo had support for serde already, and I wasn't sure if there was desire or appetite for experimenting with something else.

Edit: Added link to the example. Edit2: I'm not aware of selvage having any users of it the wild beyond my own unreleased usage, the API is explicit in it's experimental status and lack of semver compatibility in the README, and this carries over to the serialization format IMO.