Skip to content

Commit

Permalink
Clarified Hue Bounds
Browse files Browse the repository at this point in the history
  • Loading branch information
ZacHarroldC5 committed Sep 5, 2023
1 parent f464deb commit 6a09348
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions crates/bevy_render/src/color/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ impl Color {
///
/// # Arguments
///
/// * `hue` - Hue channel. [0.0, 360.0]
/// * `hue` - Hue channel. [-180.0, 180.0]
/// * `saturation` - Saturation channel. [0.0, 1.0]
/// * `lightness` - Lightness channel. [0.0, 1.0]
/// * `alpha` - Alpha channel. [0.0, 1.0]
Expand All @@ -216,7 +216,7 @@ impl Color {
///
/// # Arguments
///
/// * `hue` - Hue channel. [0.0, 360.0]
/// * `hue` - Hue channel. [-180.0, 180.0]
/// * `saturation` - Saturation channel. [0.0, 1.0]
/// * `lightness` - Lightness channel. [0.0, 1.0]
///
Expand All @@ -237,7 +237,7 @@ impl Color {
///
/// * `lightness` - Lightness channel. [0.0, 1.5]
/// * `chroma` - Chroma channel. [0.0, 1.5]
/// * `hue` - Hue channel. [0.0, 360.0]
/// * `hue` - Hue channel. [-180.0, 180.0]
/// * `alpha` - Alpha channel. [0.0, 1.0]
///
/// See also [`Color::lch`].
Expand All @@ -256,7 +256,7 @@ impl Color {
///
/// * `lightness` - Lightness channel. [0.0, 1.5]
/// * `chroma` - Chroma channel. [0.0, 1.5]
/// * `hue` - Hue channel. [0.0, 360.0]
/// * `hue` - Hue channel. [-180.0, 180.0]
///
/// See also [`Color::lcha`].
pub fn lch(lightness: f32, chroma: f32, hue: f32) -> Color {
Expand Down Expand Up @@ -963,5 +963,9 @@ mod tests {
let color_mix = color_start.mix_in::<palette::Oklcha>(color_end, 0.5);

assert_eq!(color_mix, Color::rgba(0.7299066, 0., 0.7600829, 1.));

let hue = color_start.in_space::<palette::Oklcha>().hue.into_degrees();

assert_eq!(hue, -95.94797);
}
}

0 comments on commit 6a09348

Please sign in to comment.