INNER CODE UNIT · Rust

y

sharkdp/pastel · src/lib.rs:287

            y = (cmyk.y * 100.0).round(),
            k = (cmyk.k * 100.0).round(),
            space = if format == Format::Spaces { " " } else { "" }
        )
    }

    /// Format the color as a floating point RGB-representation string (`rgb(1.0, 0.5, 0)`). If the alpha channel
    /// is `1.0`, the simplified `rgb()` format will be used instead.
    pub fn to_rgb_float_string(&self, format: Format) -> String {
        let rgba = RGBA::<f64>::from(self);
        let space = if format == Format::Spaces { " " } else { "" };
        let (a_prefix, a) = if self.alpha == 1.0 {
            ("", "".to_string())
        } else {
            (
                "a",
                format!(
                    ",{space}{alpha}",

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…