INNER CODE UNIT · Rust
from_xyz
sharkdp/pastel · src/lib.rs:121
pub fn from_xyz(x: Scalar, y: Scalar, z: Scalar, alpha: Scalar) -> Color {
Self::from(&XYZ { x, y, z, alpha })
}
/// Create a `Color` from LMS coordinates. This is the matrix inverse of the matrix that
/// appears in `to_lms`.
pub fn from_lms(l: Scalar, m: Scalar, s: Scalar, alpha: Scalar) -> Color {
Self::from(&LMS { l, m, s, alpha })
}
/// Create a `Color` from L, a and b coordinates coordinates in the Lab color
/// space. Note: See documentation for `from_xyz`. The same restrictions apply here.
///
/// See: <https://en.wikipedia.org/wiki/Lab_color_space>
pub fn from_lab(l: Scalar, a: Scalar, b: Scalar, alpha: Scalar) -> Color {
Self::from(&Lab { l, a, b, alpha })
}