You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This allows precomputing a set of colors ahead of time (for people
that are into that). To avoid generating the same colors for each
instance, users can leverage the `const_random` crate to properly
seed their generator.
I don't actually know how useful this is. I just saw a "constexpr
all the things" opportunity and wanted to see if there was anything
obvious preventing this.
One usecase I could think about is users wanting to generate a
couple colors ahead of time, give each one semantic meaning and
then use their meaning consistently. Something like this:
```rust
struct ColorPalette {
types: Color,
identifiers: Color,
other: Color,
}
const COLORS: ColorPalette = {
let mut gen = ColorGenerator::new();
ColorPalette {
types: gen.next(),
identifiers: gen.next(),
others: gen.next(),
}
}
```
0 commit comments