Make sequential_dispersed fn constant (#19659)
# Objective
- Try to make more of `bevy_color` const now that we have
const_float_arithmetic.
## Solution
Fail abjectly, because of our heavy use of traits.
I did find these functions though, so you can have a PR 🙃
This commit is contained in:
parent
12ad7479a0
commit
3926f0208f
@ -92,7 +92,7 @@ impl Hsla {
|
||||
/// // Palette with 5 distinct hues
|
||||
/// let palette = (0..5).map(Hsla::sequential_dispersed).collect::<Vec<_>>();
|
||||
/// ```
|
||||
pub fn sequential_dispersed(index: u32) -> Self {
|
||||
pub const fn sequential_dispersed(index: u32) -> Self {
|
||||
const FRAC_U32MAX_GOLDEN_RATIO: u32 = 2654435769; // (u32::MAX / Φ) rounded up
|
||||
const RATIO_360: f32 = 360.0 / u32::MAX as f32;
|
||||
|
||||
|
@ -96,7 +96,7 @@ impl Lcha {
|
||||
/// // Palette with 5 distinct hues
|
||||
/// let palette = (0..5).map(Lcha::sequential_dispersed).collect::<Vec<_>>();
|
||||
/// ```
|
||||
pub fn sequential_dispersed(index: u32) -> Self {
|
||||
pub const fn sequential_dispersed(index: u32) -> Self {
|
||||
const FRAC_U32MAX_GOLDEN_RATIO: u32 = 2654435769; // (u32::MAX / Φ) rounded up
|
||||
const RATIO_360: f32 = 360.0 / u32::MAX as f32;
|
||||
|
||||
|
@ -92,7 +92,7 @@ impl Oklcha {
|
||||
/// // Palette with 5 distinct hues
|
||||
/// let palette = (0..5).map(Oklcha::sequential_dispersed).collect::<Vec<_>>();
|
||||
/// ```
|
||||
pub fn sequential_dispersed(index: u32) -> Self {
|
||||
pub const fn sequential_dispersed(index: u32) -> Self {
|
||||
const FRAC_U32MAX_GOLDEN_RATIO: u32 = 2654435769; // (u32::MAX / Φ) rounded up
|
||||
const RATIO_360: f32 = 360.0 / u32::MAX as f32;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user