Ogeon/palette

Try to improve errors and documentation for converting from `Srgba<u8>` to `Hsla<f32>` and similar

Ogeon opened this issue · 0 comments

Ogeon commented

The error message suggests that Srgba<u8> would need to implement WithAlpha<f32>, due to this:

impl<C1: WithAlpha<T>, C2, T: Component> FromColorUnclamped<C1> for Alpha<C2, T> where
    C1::Color: IntoColorUnclamped<C2>, 

Ideas for making it more clear:

  • Change the impl above to dodge the error message. It may need to be a bit more strict.
  • Document the exceptions in the conversion implementation. Basically that component types, white points and standards don't change when converting between color spaces.
  • See if there's an attribute that can be added to improve the message when a conversion impl is missing.

See discussion #267 where it was brought up.