HslColor class Null safety

A color in the HSL color space.

The HSL color space contains channels for hue, saturation, and lightness.

Inheritance
Annotations

Constructors

HslColor(num hue, num saturation, num lightness, [int alpha = 255])
A color in the HSL color space.
const
HslColor.extrapolate(List<double> values)
Constructs a HslColor from a list of hsl values on a 0 to 1 scale.
factory
HslColor.from(ColorModel color)
Constructs a HslColor from color.
factory
HslColor.fromHex(String hex)
Constructs a HslColor from a RGB hex color.
factory
HslColor.fromList(List<num> values)
Constructs a HslColor from a list of hsl values.
factory
HslColor.random({num minHue = 0, num maxHue = 360, num minSaturation = 0, num maxSaturation = 100, num minLightness = 0, num maxLightness = 100, int? seed})
Generates a HslColor at random.
factory

Properties

alpha int
The alpha value of this color.
finalinherited
chroma double
Calculates a value representing this color's lightness on a linear scale.
read-onlyinherited
hashCode int
The hash code for this object.
read-onlyoverride
hex String
Returns this as a hexidecimal string.
read-onlyinherited
hue num
The hue value of this color.
final
inverted HslColor
Adjusts this colors hue by 180 degrees while inverting the saturation and lightness values.
read-onlyoverride
isBlack bool
Returns true if this color is pure black.
read-onlyoverride
isMonochromatic bool
Returns true if this color is monochromatic.
read-onlyoverride
isWhite bool
Returns true if this color is pure white.
read-onlyoverride
lightness num
The lightness value of this color.
final
opacity double
The alpha value as a double normalized to a 0.0 to 1.0 range.
read-onlyinherited
opposite HslColor
Returns the color with the hue opposite of this colors'.
read-onlyoverride
runtimeType Type
A representation of the runtime type of the object.
read-onlyinherited
saturation num
The saturation value of this color.
final

Methods

castTo(ColorModel other) ColorModel
Converts this color to other's color space.
inherited
convert(ColorModel other) HslColor
Converts other to this color's color space.
override
cooler(num amount, {bool relative = true}) HslColor
Adjusts the hue of this color by amount towards 270 degrees, capping the value at 270.
override
copyWith({num? hue, num? saturation, num? lightness, int? alpha}) HslColor
Returns a copy of this color modified with the provided values.
override
distanceTo(ColorModel color) double
Returns the distance between this color's hue and color's hue in degrees.
inherited
equals(ColorModel color) bool
Compares colors in the RGB color space.
inherited
interpolate(ColorModel end, double step) HslColor
Interpolates to step between this and end.
override
lerpTo(ColorModel color, int steps, {ColorSpace? colorSpace, bool excludeOriginalColors = false}) List<HslColor>
Returns the interpolated steps between this color and color.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
inherited
rotateHue(num amount) HslColor
Rotates the hue of this color by amount in degrees.
override
toCmykColor() CmykColor
Converts this to the CMYK color space.
inherited
toFactoredList() List<double>
Returns a fixed-length list containing the hue, saturation, and lightness values factored to be on 0 to 1 scale.
toFactoredListWithAlpha() List<double>
Returns a fixed-length list containing the hue, saturation, lightness, and alpha values factored to be on 0 to 1 scale.
toHsbColor() HsbColor
Converts this to the HSB color space.
inherited
toHsiColor() HsiColor
Converts this to the HSI color space.
inherited
toHslColor() HslColor
Converts this to the HSL color space.
override
toHspColor() HspColor
Converts this to the HSP color space.
inherited
toLabColor() LabColor
Converts this to the LAB color space.
inherited
toList() List<num>
Returns a fixed-length list containing the hue, saturation, and lightness values, in that order.
override
toListWithAlpha() List<num>
Returns a fixed-length list containing the hue, saturation, lightness, and alpha values, in that order.
override
toOklabColor() OklabColor
Converts this to the Oklab color space.
inherited
toRgbColor() RgbColor
Converts this to the RGB color space.
override
toString() String
A string representation of this object.
override
toXyzColor() XyzColor
Converts this to the XYZ color space.
inherited
warmer(num amount, {bool relative = true}) HslColor
Adjusts the hue of this color by amount towards 90 degrees, capping the value at 90.
override
withAlpha(int alpha) HslColor
Returns this HslColor modified with the provided alpha value.
override
withChroma(double chroma) HslColor
Converts this color to the Oklab color space, calculates and applies a new lightness value from the proivded chroma value, and converts it back to the original color space.
override
withHue(num hue) HslColor
Returns this HslColor modified with the provided hue value.
override
withOpacity(double opacity) HslColor
Returns this ColorModel with the provided opacity value.
override
withValues(List<num> values) HslColor
Returns a color in this color's color space with the values provided.
override

Operators

operator ==(Object other) bool
The equality operator.
override