fromName static method
Given a color space name, returns the known color space with that name or
throws a SassScriptException
if there is none.
If this came from a function argument, argumentName
is the argument name
(without the $
). This is used for error reporting.
Implementation
static ColorSpace fromName(String name, [String? argumentName]) =>
switch (name.toLowerCase()) {
'rgb' => rgb,
'hwb' => hwb,
'hsl' => hsl,
'srgb' => srgb,
'srgb-linear' => srgbLinear,
'display-p3' => displayP3,
'a98-rgb' => a98Rgb,
'prophoto-rgb' => prophotoRgb,
'rec2020' => rec2020,
'xyz' || 'xyz-d65' => xyzD65,
'xyz-d50' => xyzD50,
'lab' => lab,
'lch' => lch,
'oklab' => oklab,
'oklch' => oklch,
_ => throw SassScriptException(
'Unknown color space "$name".', argumentName)
};