-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Color::INDIGO is not indigo #1193
Comments
The colours where added in #859, and should be the HTML colours, so
bevy/crates/bevy_render/src/color.rs Line 45 in 72b2fc9
If I take the same values and use them as rgb, I get the expected colour: .add_resource(ClearColor(Color::rgb(0.29, 0.0, 0.51))) I'm not very fluent in colour spaces, so would be great if someone that knows those better could take a look at it |
I've read some on color spaces, but to spare you the details (although I do believe every game programmer should understand the basics about sRGB and gamma correction), when describing colors you most often want to avoid using the linear colors that haven't been gamma corrected. They are used only when mixing and blending colors, and when sending them to the screen (most often done automatically by the GPU in a shader). When giving color values, they should always be in sRGB (the standard RGB space, aka gamma corrected), and this is the colorspace that all programs use when interfacing with users (the values they give, and what you give). TLDR: change it from linear to srbg, which is the Edit: actually looking at it, I guess you can't since |
I noticed this and did some testing, |
I grabbed the list of 148 (139*) "named colours" in CSS to generate this code using bevy's own This is Indigo: use bevy::prelude::*;
#[allow(clippy::excessive_precision)]
/// #4B0082 Indigo
pub const INDIGO: Color =
Color::rgb_linear(0.07036010921001434326171875, 0., 0.223227977752685546875);
fn main() {
App::build()
.add_plugins(DefaultPlugins)
.add_resource(ClearColor(INDIGO))
.run();
} *duplicates are: "#00FFFF": [
"Aqua",
"Cyan",
],
"#FF00FF": [
"Fuchsia",
"Magenta",
],
"#778899": [
"Light Slate Gray",
"Light Slate Grey",
],
"#708090": [
"Slate Gray",
"Slate Grey",
],
"#808080": [
"Gray",
"Grey",
],
"#A9A9A9": [
"Dark Gray",
"Dark Grey",
],
"#D3D3D3": [
"Light Gray",
"Light Grey",
],
"#696969": [
"Dim Gray",
"Dim Grey",
],
"#2F4F4F": [
"Dark Slate Gray",
"Dark Slate Grey",
], |
Yes... and no 😃 The full fix would be to have a bevy/crates/bevy_render/src/color.rs Line 14 in cf0e9f9
But fixing the colours to have the correct value in linear until this is done is better than what we have now. |
So the list that's currently in Bevy is a smaller subset of that.
Maybe I'll have a go at this a bit later on. What should these types be called? Relevant discussion: #688 |
I would go with |
Bevy version
Bevy 4.0.0
Operating system & version
Ubuntu 20.04
What you did
Was looking at the breakout example where a
ClearColor
resource was added. I noticed theColor
struct has some constant values to choose from, including the valueINDIGO
. When using that value on a simple default app, the color generated is much more purple than indigo. A simple reproducible example:What you expected to happen
The background color to be indigo.
What actually happened
The background color was purple.
Additional information
My initial search of a hex value for indigo led to #4B0082, which appears to be the programming for
Color::INDIGO
. Color pickers seem to show that as more of a purple. However I don't want this issue to get heated over the definition of indigo, so do with this info what you will.Below is what I see when using
Color::INDIGO
:From a quick Google search, indigo more closely resembles the color below.
The text was updated successfully, but these errors were encountered: