INNER CODE UNIT · Rust

s

sharkdp/pastel · src/lib.rs:199

            s = 100.0 * self.saturation,
            l = 100.0 * self.lightness,
            a = a,
        )
    }

    /// Convert a `Color` to its hue, saturation, value and alpha values. The hue is given
    /// in degrees, as a number between 0.0 and 360.0. Saturation, value and alpha are numbers
    /// between 0.0 and 1.0.
    pub fn to_hsva(&self) -> HSVA {
        HSVA::from(self)
    }

    /// Format the color as a HSV-representation string (`hsva(123, 50.3%, 80.1%, 0.4)`). If the
    /// alpha channel is `1.0`, the simplified `hsv()` format will be used instead.
    pub fn to_hsv_string(&self, format: Format) -> String {
        let hsv = HSVA::from(self);
        let space = if format == Format::Spaces { " " } else { "" };

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…