INNER CODE UNIT · Rust

from_lch

sharkdp/pastel · src/lib.rs:152

    pub fn from_lch(l: Scalar, c: Scalar, h: Scalar, alpha: Scalar) -> Color {
        Self::from(&LCh { l, c, h, alpha })
    }

    /// Create a `Color` from lightness, chroma and hue coordinates in the OkLCh color space.
    /// This is a cylindrical transform of the OkLab color space. Note: See documentation for
    /// `from_xyz`. The same restrictions apply here.
    ///
    /// See: <https://bottosson.github.io/posts/oklab>
    pub fn from_oklch(l: Scalar, c: Scalar, h: Scalar, alpha: Scalar) -> Color {
        Self::from(&OkLCh { l, c, h, alpha })
    }

    /// Create a `Color` from  the four colours of the CMYK model: Cyan, Magenta, Yellow and Black.
    /// The CMYK colours are subtractive. This means the colours get darker as you blend them together
    pub fn from_cmyk(c: Scalar, m: Scalar, y: Scalar, k: Scalar) -> Color {
        Self::from(&CMYK { c, m, y, k })
    }

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…