channel method
Returns the value of the given channel
in this color, or throws a
SassScriptException
if it doesn't exist.
If this came from a function argument, colorName
is the argument name
for this color and channelName
is the argument name for channel
(without the $
). These are used for error reporting.
Implementation
double channel(String channel, {String? colorName, String? channelName}) {
var channels = space.channels;
if (channel == channels[0].name) return channel0;
if (channel == channels[1].name) return channel1;
if (channel == channels[2].name) return channel2;
if (channel == 'alpha') return alpha;
throw SassScriptException(
"Color $this doesn't have a channel named \"$channel\".", channelName);
}