SassColor class
A SassScript color.
- Inheritance
- Available extensions
- Annotations
-
- @sealed
Constructors
- SassColor.a98Rgb(double? red, double? green, double? blue, [double? alpha = 1])
-
Creates a color in ColorSpace.a98Rgb.
factory
- SassColor.displayP3(double? red, double? green, double? blue, [double? alpha = 1])
-
Creates a color in ColorSpace.displayP3.
factory
-
SassColor.forSpace(ColorSpace space, List<
double?> channels, [double? alpha = 1]) -
Creates a color in the color space named
space
.factory - SassColor.hsl(num? hue, num? saturation, num? lightness, [num? alpha = 1])
-
Creates a color in ColorSpace.hsl.
factory
- SassColor.hwb(num? hue, num? whiteness, num? blackness, [num? alpha = 1])
-
Creates a color in ColorSpace.hwb.
factory
- SassColor.lab(double? lightness, double? a, double? b, [double? alpha = 1])
-
Creates a color in ColorSpace.lab.
factory
- SassColor.lch(double? lightness, double? chroma, double? hue, [double? alpha = 1])
-
Creates a color in ColorSpace.lch.
factory
- SassColor.oklab(double? lightness, double? a, double? b, [double? alpha = 1])
-
Creates a color in ColorSpace.oklab.
factory
- SassColor.oklch(double? lightness, double? chroma, double? hue, [double? alpha = 1])
-
Creates a color in ColorSpace.oklch.
factory
- SassColor.prophotoRgb(double? red, double? green, double? blue, [double? alpha = 1])
-
Creates a color in ColorSpace.prophotoRgb.
factory
- SassColor.rec2020(double? red, double? green, double? blue, [double? alpha = 1])
-
Creates a color in ColorSpace.rec2020.
factory
- SassColor.rgb(num? red, num? green, num? blue, [num? alpha = 1])
-
Creates a color in ColorSpace.rgb.
factory
- SassColor.srgb(double? red, double? green, double? blue, [double? alpha = 1])
-
Creates a color in ColorSpace.srgb.
factory
- SassColor.srgbLinear(double? red, double? green, double? blue, [double? alpha = 1])
-
Creates a color in ColorSpace.srgbLinear.
factory
- SassColor.xyzD50(double? x, double? y, double? z, [double? alpha = 1])
-
Creates a color in ColorSpace.xyzD50.
factory
- SassColor.xyzD65(double? x, double? y, double? z, [double? alpha = 1])
-
Creates a color in ColorSpace.xyzD65.
factory
Properties
- alpha → double
-
This color's alpha channel, between
0
and1
.no setter -
asList
→ List<
Value> -
This value as a list.
no setterinherited
- blackness → double
-
This color's blackness, a percentage between
0
and100
.no setter - blue → int
-
This color's blue channel, between
0
and255
.no setter -
channels
→ List<
double> -
The values of this color's channels (excluding the alpha channel).
no setter
-
channelsOrNull
→ List<
double?> -
The values of this color's channels (excluding the alpha channel), or
null
for missing channels.no setter - green → int
-
This color's green channel, between
0
and255
.no setter - hasBrackets → bool
-
Whether this value as a list has brackets.
no setterinherited
- hashCode → int
-
The hash code for this object.
no setteroverride
- hue → double
-
This color's hue, between
0
and360
.no setter - isInGamut → bool
-
Whether this color is in-gamut for its color space.
no setter
- isLegacy → bool
-
Whether this is a legacy color—that is, a color defined using
pre-color-spaces syntax that preserves comaptibility with old color
behavior and semantics.
no setter
- isTruthy → bool
-
Whether the value counts as
true
in an@if
statement and other contexts.no setterinherited - lightness → double
-
This color's lightness, a percentage between
0
and100
.no setter - realNull → Value?
-
Returns Dart's
null
value if this is sassNull, and returnsthis
otherwise.no setterinherited - red → int
-
This color's red channel, between
0
and255
.no setter - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- saturation → double
-
This color's saturation, a percentage between
0
and100
.no setter - separator → ListSeparator
-
The separator for this value as a list.
no setterinherited
- space → ColorSpace
-
This color's space.
no setter
- whiteness → double
-
This color's whiteness, a percentage between
0
and100
.no setter
Methods
-
assertBoolean(
[String? name]) → SassBoolean -
Throws a
SassScriptException
ifthis
isn't a boolean.inherited -
assertCalculation(
[String? name]) → SassCalculation -
Throws a
SassScriptException
ifthis
isn't a calculation.inherited -
assertColor(
[String? name]) → SassColor -
Throws a
SassScriptException
ifthis
isn't a color.override -
assertFunction(
[String? name]) → SassFunction -
Throws a
SassScriptException
ifthis
isn't a function reference.inherited -
assertMap(
[String? name]) → SassMap -
Throws a
SassScriptException
ifthis
isn't a map.inherited -
assertMixin(
[String? name]) → SassMixin -
Throws a
SassScriptException
ifthis
isn't a mixin reference.inherited -
assertNumber(
[String? name]) → SassNumber -
Throws a
SassScriptException
ifthis
isn't a number.inherited -
assertString(
[String? name]) → SassString -
Throws a
SassScriptException
ifthis
isn't a string.inherited -
changeAlpha(
num alpha) → SassColor -
Returns a new copy of this color with the alpha channel set to
alpha
. -
changeChannels(
Map< String, double> newValues, {ColorSpace? space, String? colorName}) → SassColor - Changes one or more of this color's channels and returns the result.
-
changeHsl(
{num? hue, num? saturation, num? lightness, num? alpha}) → SassColor - Changes one or more of this color's HSL channels and returns the result.
-
changeHwb(
{num? hue, num? whiteness, num? blackness, num? alpha}) → SassColor - Changes one or more of this color's HWB channels and returns the result.
-
changeRgb(
{int? red, int? green, int? blue, num? alpha}) → SassColor - Changes one or more of this color's RGB channels and returns the result.
-
channel(
String channel, {String? colorName, String? channelName}) → double -
Returns the value of the given
channel
in this color, or throws aSassScriptException
if it doesn't exist. -
interpolate(
SassColor other, InterpolationMethod method, {double? weight, bool legacyMissing = true}) → SassColor -
Returns a color partway between
this
andother
according tomethod
, as defined by the CSS Color 4 color interpolation procedure. -
isChannelMissing(
String channel, {String? colorName, String? channelName}) → bool -
Returns whether the given
channel
in this color is missing. -
isChannelPowerless(
String channel, {String? colorName, String? channelName}) → bool -
Returns whether the given
channel
in this color is powerless. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
sassIndexToListIndex(
Value sassIndex, [String? name]) → int -
Converts
sassIndex
into a Dart-style index into the list returned by asList.inherited -
toCssString(
{bool quote = true}) → String -
Returns a valid CSS representation of
this
.inherited -
toGamut(
GamutMapMethod method) → SassColor - Returns a copy of this color that's in-gamut in the current color space.
-
toSpace(
ColorSpace space, {bool legacyMissing = true}) → SassColor -
Converts this color to
space
. -
toString(
) → String -
Returns a string representation of
this
.inherited -
tryMap(
) → SassMap? -
Returns
this
as a SassMap if it is one (including empty lists, which count as empty maps) or returnsnull
if it's not.inherited -
withListContents(
Iterable< Value> contents, {ListSeparator? separator, bool? brackets}) → SassList -
Returns a new list containing
contents
that defaults to this value's separator and brackets.inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override