Skip to content
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

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

Open
Ogeon opened this issue Jan 5, 2022 Discussed in #267 · 0 comments
Labels
documentation Related to things like README or the API documentation.

Comments

@Ogeon
Copy link
Owner

Ogeon commented Jan 5, 2022

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.

@Ogeon Ogeon added the documentation Related to things like README or the API documentation. label Mar 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Related to things like README or the API documentation.
Projects
None yet
Development

No branches or pull requests

1 participant