Creates an RGB color.
If space is missing, only undefined should be used to indicate that
alpha isn't passed. If null is used instead, it will be treated as a
missing component. See breaking changes for details.
If space is defined and null is passed for any component, it will be
treated as a missing component.
Creates an HSL color.
If space is missing, only undefined should be used to indicate that
alpha isn't passed. If null is used instead, it will be treated as a
missing component. See breaking changes for details.
If space is defined and null is passed for any component, it will be
treated as a missing component.
Creates an HWB color.
If space is missing, only undefined should be used to indicate that
alpha isn't passed. If null is used instead, it will be treated as a
missing component. See breaking changes for details.
If space is defined and null is passed for any component, it will be
treated as a missing component.
If null is passed for any component, it will be treated as a missing
component.
Creates an LCH or Oklch color.
If null is passed for any component, it will be treated as a missing
component.
Creates a color in a predefined RGB color space.
If null is passed for any component, it will be treated as a missing
component.
Creates a color in a predefined XYZ color space.
If null is passed for any component, it will be treated as a missing
component.
This color's alpha channel, between 0 and 1.
This value as a list.
All SassScript values can be used as lists. Maps count as lists of pairs, and all other values count as single-value lists.
An immutable List from the immutable
package.
A list of this color's channel values (excluding alpha), with missing
channels converted to 0.
A list of this color's channel values (excluding alpha), with missing
channels converted to null.
Whether this value as a list has brackets.
All SassScript values can be used as lists. Maps count as lists of pairs, and all other values count as single-value lists.
A boolean indicating whether this color is in a legacy color space (rgb,
hsl, or hwb).
Whether the value counts as true in an @if statement and other
contexts.
Returns JavaScript's null value if this is sassNull, and returns
this otherwise.
The separator for this value as a list.
All SassScript values can be used as lists. Maps count as lists of pairs, and all other values count as single-value lists.
The name of this color's space.
Throws if this isn't a SassBoolean.
Heads up! Functions should generally use isTruthy rather than requiring a literal boolean.
Optionalname: string
The name of the function argument this came from (without
the $) if it came from an argument. Used for error reporting.
Throws if this isn't a SassCalculation.
Optionalname: string
The name of the function argument this came from (without
the $) if it came from an argument. Used for error reporting.
Throws if this isn't a SassFunction.
Optionalname: string
The name of the function argument this came from (without
the $) if it came from an argument. Used for error reporting.
Throws if this isn't a SassNumber.
Optionalname: string
The name of the function argument this came from (without
the $) if it came from an argument. Used for error reporting.
Throws if this isn't a SassString.
Optionalname: string
The name of the function argument this came from (without
the $) if it came from an argument. Used for error reporting.
Returns a new color that's the result of changing one or more of this color's HSL channels.
Returns a new color that's the result of changing one or more of this color's HWB channels.
Returns a new color that's the result of changing one or more of this color's Lab channels.
Returns a new color that's the result of changing one or more of this color's LCH channels.
Returns a new color that's the result of changing one or more of this color's RGB channels.
Returns a new color that's the result of changing one or more of this color's XYZ channels.
Returns the value of a single specified channel of this color, with
missing channels converted to 0.
Returns the value of a single specified channel of this color after
converting this color to the specified space, with missing channels
converted to 0.
Returns the value of a single specified channel of this color, with
missing channels converted to 0.
Returns the value of a single specified channel of this color, with
missing channels converted to 0.
Returns the value of a single specified channel of this color, with
missing channels converted to 0.
Returns the value of a single specified channel of this color, with
missing channels converted to 0.
Returns the value of a single specified channel of this color, with
missing channels converted to 0.
Returns the value at index index in this value as a list, or undefined
if index isn't valid for this list.
All SassScript values can be used as lists. Maps count as lists of pairs, and all other values count as single-value lists.
This is a shorthand for this.asList.get(index), although it may be more
efficient in some cases.
Heads up! This method uses the same indexing conventions as the
immutable package: unlike Sass the index of the first element is 0, but
like Sass negative numbers index from the end of the list.
Returns a hash code that can be used to store this in a hash map.
Returns a color partway between this color and color2 according to
method, as defined by the CSS Color 4 color interpolation procedure.
If method is missing and this color is in a rectangular color space (Lab,
Oklab, RGB, and XYZ spaces), method defaults to the color space of this
color. Otherwise, method defaults to a space separated list containing
the color space of this color and the string "shorter".
The weight is a number between 0 and 1 that indicates how much of this
color should be in the resulting color. If omitted, it defaults to 0.5.
Optionaloptions: { method?: HueInterpolationMethod; weight?: number }Returns a boolean indicating whether a given channel value is a missing channel.
Returns a boolean indicating whether a given channel is powerless in
this color. This is a special state that's defined for individual color
spaces, which indicates that a channel's value won't affect how a color is
displayed.
Returns a boolean indicating whether a given channel is powerless in
this color. This is a special state that's defined for individual color
spaces, which indicates that a channel's value won't affect how a color is
displayed.
Optionaloptions: { space: "hsl" }Returns a boolean indicating whether a given channel is powerless in
this color. This is a special state that's defined for individual color
spaces, which indicates that a channel's value won't affect how a color is
displayed.
Optionaloptions: { space: "hwb" }Returns a boolean indicating whether a given channel is powerless in
this color. This is a special state that's defined for individual color
spaces, which indicates that a channel's value won't affect how a color is
displayed.
Optionaloptions: { space: ColorSpaceLab }Returns a boolean indicating whether a given channel is powerless in
this color. This is a special state that's defined for individual color
spaces, which indicates that a channel's value won't affect how a color is
displayed.
Optionaloptions: { space: ColorSpaceLch }Returns a boolean indicating whether a given channel is powerless in
this color. This is a special state that's defined for individual color
spaces, which indicates that a channel's value won't affect how a color is
displayed.
Optionaloptions: { space: ColorSpaceRgb }Returns a boolean indicating whether a given channel is powerless in
this color. This is a special state that's defined for individual color
spaces, which indicates that a channel's value won't affect how a color is
displayed.
Optionaloptions: { space: ColorSpaceXyz }Returns a boolean indicating whether this color is in-gamut (as opposed to
having one or more of its channels out of bounds) for the specified
space, or its current color space if space is not specified.
Optionalspace: KnownColorSpaceConverts sassIndex into a JavaScript-style index into the list returned
by asList.
Sass indexes are one-based, while JavaScript indexes are zero-based. Sass indexes may also be negative in order to index from the end of the list.
The Sass-style index into this as a list.
Optionalname: string
The name of the function argument sassIndex came from
(without the $) if it came from an argument. Used for error reporting.
Error If sassIndex isn't a number, if that number isn't an
integer, or if that integer isn't a valid index for asList.
Returns a copy of this color, modified so it is in-gamut for the specified
space—or the current color space if space is not specified—using
method to map out-of-gamut colors into the desired gamut.
Returns a new color that's the result of converting this color to the
specified space.
Returns this as a map if it counts as one (empty lists count as empty
maps) or null if it doesn't.
Sass's color type.
No matter what representation was originally used to create this color, all of its channels are accessible.