mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-08 04:36:45 +01:00
create input/output per track
This commit is contained in:
parent
b1ff549514
commit
bc9be689a8
7 changed files with 93 additions and 84 deletions
|
|
@ -32,8 +32,8 @@ impl ItemColor {
|
|||
}
|
||||
pub fn random_dark () -> Self {
|
||||
let mut rng = thread_rng();
|
||||
let lo = Okhsl::new(-180.0, 0.01, 0.05);
|
||||
let hi = Okhsl::new( 180.0, 0.5, 0.2);
|
||||
let lo = Okhsl::new(-180.0, 0.025, 0.075);
|
||||
let hi = Okhsl::new( 180.0, 0.5, 0.150);
|
||||
UniformOkhsl::new(lo, hi).sample(&mut rng).into()
|
||||
}
|
||||
pub fn random_near (color: Self, distance: f32) -> Self {
|
||||
|
|
@ -47,9 +47,10 @@ impl ItemColor {
|
|||
impl From<ItemColor> for ItemColorTriplet {
|
||||
fn from (base: ItemColor) -> Self {
|
||||
let mut light = base.okhsl.clone();
|
||||
light.lightness = (light.lightness * 1.15).min(Okhsl::<f32>::max_saturation());
|
||||
light.lightness = (light.lightness * 1.15).min(Okhsl::<f32>::max_lightness());
|
||||
let mut dark = base.okhsl.clone();
|
||||
dark.lightness = (dark.lightness * 0.85).max(Okhsl::<f32>::min_saturation());
|
||||
dark.lightness = (dark.lightness * 0.85).max(Okhsl::<f32>::min_lightness());
|
||||
dark.saturation = (dark.saturation * 0.85).max(Okhsl::<f32>::min_saturation());
|
||||
Self { base, light: light.into(), dark: dark.into() }
|
||||
}
|
||||
}
|
||||
|
|
@ -67,11 +68,7 @@ pub fn okhsl_to_rgb (color: Okhsl<f32>) -> Color {
|
|||
}
|
||||
pub fn rgb_to_okhsl (color: Color) -> Okhsl<f32> {
|
||||
if let Color::Rgb(r, g, b) = color {
|
||||
Okhsl::from_color(Srgb::new(
|
||||
r as f32 / 255.0,
|
||||
g as f32 / 255.0,
|
||||
b as f32 / 255.0,
|
||||
))
|
||||
Okhsl::from_color(Srgb::new(r as f32 / 255.0, g as f32 / 255.0, b as f32 / 255.0))
|
||||
} else {
|
||||
unreachable!("only Color::Rgb is supported")
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue