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

Color docs should specify acceptable value ranges #17508

Closed
thebluefish opened this issue Jan 23, 2025 · 0 comments · Fixed by #17601
Closed

Color docs should specify acceptable value ranges #17508

thebluefish opened this issue Jan 23, 2025 · 0 comments · Fixed by #17601
Labels
A-Color Color spaces and color math C-Docs An addition or correction to our documentation D-Trivial Nice and easy! A great choice to get started with Bevy S-Ready-For-Implementation This issue is ready for an implementation PR. Go for it!

Comments

@thebluefish
Copy link
Contributor

thebluefish commented Jan 23, 2025

https://docs.rs/bevy/latest/bevy/prelude/enum.Color.html

Most of the methods to construct a Color accept values in the range [0..1]. A common beginner mistake is assuming the range [0..255]. Hue is typically in the range [0..360]. LABA/LCHA have a Lightness in the range [0..1.5]. I might have missed some exceptions.

These ranges are documented for the color-space structs being constructed by each method, but IMO should be documented in the method, too.

@thebluefish thebluefish added C-Docs An addition or correction to our documentation S-Needs-Triage This issue needs to be labelled labels Jan 23, 2025
@BenjaminBrienen BenjaminBrienen added D-Trivial Nice and easy! A great choice to get started with Bevy S-Ready-For-Implementation This issue is ready for an implementation PR. Go for it! A-Color Color spaces and color math and removed S-Needs-Triage This issue needs to be labelled labels Jan 23, 2025
janis-bhm added a commit to janis-bhm/bevy that referenced this issue Jan 29, 2025
According to bevyengine#17508, the constructors of `Color` are missing docs for the range
in which the values are valid.
This commit contains the least controversial docs.
janis-bhm added a commit to janis-bhm/bevy that referenced this issue Jan 29, 2025
…7508)

Fixes bevyengine#17508, accordign to which the constructors of `Color` are missing docs for the range
in which the values are valid.
This commit contains the least controversial docs.
janis-bhm added a commit to janis-bhm/bevy that referenced this issue Jan 29, 2025
Partially fixes bevyengine#17508

`Color::srgba_u8()` and `Color::srgb_u8` already have doc comments that might be
sufficient, but aren't in line with the underlying colour type's constructor, so
I moved them into a separate commit.
janis-bhm added a commit to janis-bhm/bevy that referenced this issue Jan 29, 2025
…7508)

# Objective
Fixes bevyengine#17508, according to which the constructors of `Color` are missing docs for the range
in which the values are valid.
This commit contains the least controversial docs.
janis-bhm added a commit to janis-bhm/bevy that referenced this issue Jan 29, 2025
# Objective
Partially fixes bevyengine#17508

`Color::srgba_u8()` and `Color::srgb_u8` already have doc comments that might be
sufficient, but aren't in line with the underlying colour type's constructor, so
I moved them into a separate commit.
janis-bhm added a commit to janis-bhm/bevy that referenced this issue Jan 29, 2025
According to bevyengine#17508, the constructors of `Color` are missing docs for the range
in which the values are valid.
This commit contains the least controversial docs.
github-merge-queue bot pushed a commit that referenced this issue Jan 29, 2025
…derlying constructor (#17601)

# Objective

Fixes #17508

`bevy_color::Color` constructors don't have docs explaining the valid
range for the values passed.

## Solution

I've mostly copied the docs from the respective underlying type's docs,
because that seemed most consistent and accurate.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Color Color spaces and color math C-Docs An addition or correction to our documentation D-Trivial Nice and easy! A great choice to get started with Bevy S-Ready-For-Implementation This issue is ready for an implementation PR. Go for it!
Projects
None yet
2 participants