isChannelMissing method

bool isChannelMissing(
  1. String channel, {
  2. String? colorName,
  3. String? channelName,
})

Returns whether the given channel in this color is missing.

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

bool isChannelMissing(String channel,
    {String? colorName, String? channelName}) {
  var channels = space.channels;
  if (channel == channels[0].name) return isChannel0Missing;
  if (channel == channels[1].name) return isChannel1Missing;
  if (channel == channels[2].name) return isChannel2Missing;
  if (channel == 'alpha') return isAlphaMissing;

  throw SassScriptException(
      "Color $this doesn't have a channel named \"$channel\".", channelName);
}