-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
bevy_color
: Add Laba
to support Lab Color Model
#12115
Conversation
The prerequisite PR has been merged :) Please rebase when you get a chance and we can add this in. |
8396d32
to
754e3cf
Compare
Also added a couple of `macro_rules` definitions to automate highly repetitive definitions.
754e3cf
to
d44ae60
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to explain about derived conversions in the crate-level docs?
Yeah, I'd like to develop a bit of a map for the conversions in the crate level docs. That can be split out into another PR easily though. |
Also, I know we've been trying to explain to new users what all these various color spaces are for but at some point we will have to give up, because the distinctions are (a) hair-splitting and (b) historical, which makes it hard to write a clear and distinct explanation. |
If we go that route, I'd recommend |
That's definitely the route I'd want to take. I'll make a little PR for this now |
# Objective - Improve compatibility with CSS Module 4 - Simplify `Lcha` conversion functions ## Solution - Added `Laba` which implements the Lab color model. - Updated `Color` and `LegacyColor` accordingly. ## Migration Guide - Convert `Laba` to either `Xyza` or `Lcha` using the provided `From` implementations and then handle accordingly. ## Notes The Lab color space is a required stepping stone when converting between XYZ and Lch, therefore we already use the Lab color model, just in an nameless fashion prone to errors. This PR also includes a slightly broader refactor of the `From` implementations between the various colour spaces to better reflect the graph of definitions. My goal was to keep domain specific knowledge of each colour space contained to their respective files (e.g., the `From<Oklaba> for LinearRgba` definition was in `linear_rgba.rs` when it probably belongs in `oklaba.rs`, since Linear sRGB is a fundamental space and Oklab is defined in its relation to it)
Objective
Lcha
conversion functionsSolution
Laba
which implements the Lab color model.Color
andLegacyColor
accordingly.Migration Guide
Laba
to eitherXyza
orLcha
using the providedFrom
implementations and then handle accordingly.Notes
The Lab color space is a required stepping stone when converting between XYZ and Lch, therefore we already use the Lab color model, just in an nameless fashion prone to errors.
This PR also includes a slightly broader refactor of the
From
implementations between the various colour spaces to better reflect the graph of definitions. My goal was to keep domain specific knowledge of each colour space contained to their respective files (e.g., theFrom<Oklaba> for LinearRgba
definition was inlinear_rgba.rs
when it probably belongs inoklaba.rs
, since Linear sRGB is a fundamental space and Oklab is defined in its relation to it)