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

LCH Color Function #766

Closed
entropylost opened this issue Nov 2, 2020 · 2 comments
Closed

LCH Color Function #766

entropylost opened this issue Nov 2, 2020 · 2 comments
Labels
A-Rendering Drawing game state to the screen C-Enhancement A new feature

Comments

@entropylost
Copy link
Contributor

What problem does this solve or what need does it fill?

Colors are difficult to read. For example, it's hard to tell that Color::rgb(0.8, 0.3, 0.7) is pink.

Describe the solution would you like?

Add a LCH color function as well as the HEX colors. The LCH color space allows for colors that are somewhat related to how people actually see it.

Describe the alternative(s) you've considered?

N/A

Additional context

This blog post (https://lea.verou.me/2020/04/lch-colors-in-css-what-why-and-how/) provides a good explanation of what the LCH color space is.

@entropylost entropylost added the C-Enhancement A new feature label Nov 2, 2020
@Moxinilian Moxinilian added the A-Rendering Drawing game state to the screen label Nov 2, 2020
@MikP0
Copy link

MikP0 commented Nov 5, 2020

Hello!
There is actually a way to make colors more readable. Just use Color::hex function like this:

let rgb_color = Color::hex("ff0000");
let rgba_color = Color::hex("ffff0001");
println!("{:?}", rgb_color); //Ok(Color { red: 1.0, green: 0.0, blue: 0.0, alpha: 1.0 })
println!("{:?}", rgba_color); //Ok(Color { red: 1.0, green: 1.0, blue: 0.0, alpha: 0.003921569 })

However, I do agree that another color space would be a nice addition. I'll try to take further steps in order to contribute.
Cheers!

@luiswirth
Copy link

I'd suggest #1146 for solving this issue.

bors bot pushed a commit that referenced this issue Feb 6, 2023
# Objective

- Fixes #766

## Solution

- Add a new `Lcha` member to `bevy_render::color::Color` enum

---

## Changelog

- Add a new `Lcha` member to `bevy_render::color::Color` enum
- Add `bevy_render::color::LchRepresentation` struct
@bors bors bot closed this as completed in 7b7b34f Feb 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Rendering Drawing game state to the screen C-Enhancement A new feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants