SassColor class

A SassScript color.

Inheritance
Available extensions
Annotations
  • @sealed

Constructors

SassColor.hsl(num hue, num saturation, num lightness, [num? alpha = 1])
Creates an HSL color.
SassColor.hwb(num hue, num whiteness, num blackness, [num? alpha = 1])
Creates an HWB color.
factory
SassColor.rgb(int red, int green, int blue, [num? alpha = 1])
Creates an RGB color.

Properties

alpha double
This color's alpha channel, between 0 and 1.
no setter
asList List<Value>
This value as a list.
no setterinherited
blackness double
This color's blackness, a percentage between 0 and 100.
no setter
blue int
This color's blue channel, between 0 and 255.
no setter
green int
This color's green channel, between 0 and 255.
no setter
hasBrackets bool
Whether this value as a list has brackets.
no setterinherited
hasCalculatedHsl bool

Available on SassColor, provided by the SassApiColor extension

Whether the hue, saturation, and lightness fields have already been computed for this value.
no setter
hasCalculatedRgb bool

Available on SassColor, provided by the SassApiColor extension

Whether the red, green, and blue fields have already been computed for this value.
no setter
hashCode int
The hash code for this object.
no setteroverride
hue double
This color's hue, between 0 and 360.
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 and 100.
no setter
realNull Value?
Returns Dart's null value if this is sassNull, and returns this otherwise.
no setterinherited
red int
This color's red channel, between 0 and 255.
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 and 100.
no setter
separator ListSeparator
The separator for this value as a list.
no setterinherited
whiteness double
This color's whiteness, a percentage between 0 and 100.
no setter

Methods

assertBoolean([String? name]) SassBoolean
Throws a SassScriptException if this isn't a boolean.
inherited
assertCalculation([String? name]) SassCalculation
Throws a SassScriptException if this isn't a calculation.
inherited
assertColor([String? name]) SassColor
Throws a SassScriptException if this isn't a color.
override
assertComplexSelector({String? name, bool allowParent = false}) ComplexSelector

Available on Value, provided by the SassApiValue extension

Parses this as a complex selector, in the same manner as the selector-parse() function.
assertCompoundSelector({String? name, bool allowParent = false}) CompoundSelector

Available on Value, provided by the SassApiValue extension

Parses this as a compound selector, in the same manner as the selector-parse() function.
assertFunction([String? name]) SassFunction
Throws a SassScriptException if this isn't a function reference.
inherited
assertMap([String? name]) SassMap
Throws a SassScriptException if this isn't a map.
inherited
assertMixin([String? name]) SassMixin
Throws a SassScriptException if this isn't a mixin reference.
inherited
assertNumber([String? name]) SassNumber
Throws a SassScriptException if this isn't a number.
inherited
assertSelector({String? name, bool allowParent = false}) SelectorList

Available on Value, provided by the SassApiValue extension

Parses this as a selector list, in the same manner as the selector-parse() function.
assertSimpleSelector({String? name, bool allowParent = false}) SimpleSelector

Available on Value, provided by the SassApiValue extension

Parses this as a simple selector, in the same manner as the selector-parse() function.
assertString([String? name]) SassString
Throws a SassScriptException if this isn't a string.
inherited
changeAlpha(num alpha) SassColor
Returns a new copy of this color with the alpha channel set to alpha.
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.
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
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 returns null 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