-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Decouple palette Rgb from Sled #64
Comments
Lets play some more with this idea. If we let the user specify the the data structure they want to use for colors, we can totally drop palette as a dependency altogether. We'd just have to add some trait bounds to make some guarantees. One for example, we'd probably need When #26 gets added, that compiler feature would probably add some requirements like I'll be experimenting with this design on a the |
I've got this compiling on the decouple_colors branch. Unit tests don't pass yet as they'll need some rewriting, but this seems to be working! use palette::rgb::Rgb;
let mut palette_sled = Sled::<Rgb>::new("path/to/config.yap")?;
let mut tuple_sled = Sled::<(u8, u8, u8)>::new("path/to/config.yap")?;
palette_sled.set_all(Rgb::new(1.0, 1.0, 1.0));
tuple_sled.set_at_angle(0.2, (64, 128, 255)); |
Added bonus, with palette moved from a dependency to a dev dependency, a vanilla build of spatial_led compiles much faster. Goes from 31 dependencies down to 20, compiling on release went from 10.44s down to 3.22s. |
Completed by #91 |
Right now to create a sled, your only option is:
Which will populate the Sled struct with LED data, each LED getting 32-bits/channel for color. This behavior should be overridable.
Perhaps even extending to support other palette spaces like RGBA, HSL, etc.
The text was updated successfully, but these errors were encountered: