mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 04:06:45 +01:00
don't alter saturation
This commit is contained in:
parent
87379ff76b
commit
bab0235c20
2 changed files with 6 additions and 9 deletions
|
|
@ -26,7 +26,7 @@ impl From<Color> for ItemColor {
|
|||
impl ItemColor {
|
||||
pub fn random () -> Self {
|
||||
let mut rng = thread_rng();
|
||||
let lo = Okhsl::new(-180.0, 0.01, 0.2);
|
||||
let lo = Okhsl::new(-180.0, 0.01, 0.25);
|
||||
let hi = Okhsl::new( 180.0, 0.9, 0.5);
|
||||
UniformOkhsl::new(lo, hi).sample(&mut rng).into()
|
||||
}
|
||||
|
|
@ -46,12 +46,10 @@ impl ItemColor {
|
|||
}
|
||||
impl From<ItemColor> for ItemColorTriplet {
|
||||
fn from (base: ItemColor) -> Self {
|
||||
let mut light = base.okhsl.clone();
|
||||
light.saturation = (light.saturation * 0.9).max(Okhsl::<f32>::min_saturation());
|
||||
light.lightness = (light.lightness * 1.1).min(Okhsl::<f32>::max_saturation());
|
||||
let mut dark = base.okhsl.clone();
|
||||
dark.saturation = (dark.saturation * 1.1).min(Okhsl::<f32>::max_saturation());
|
||||
dark.lightness = (dark.lightness * 0.9).max(Okhsl::<f32>::min_saturation());
|
||||
let mut light = base.okhsl.clone();
|
||||
light.lightness = (light.lightness * 1.15).min(Okhsl::<f32>::max_saturation());
|
||||
let mut dark = base.okhsl.clone();
|
||||
dark.lightness = (dark.lightness * 0.85).max(Okhsl::<f32>::min_saturation());
|
||||
Self { base, light: light.into(), dark: dark.into() }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue