HslColor class
A color in the HSL color space.
The HSL color space contains channels for hue, saturation, and lightness.
- Implemented types
 - Available extensions
 
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 
hslvalues on a0to1scale.factory - HslColor.from(ColorModel color)
 - 
          Constructs a HslColor from 
color.factory - HslColor.fromColor(Color color)
 - 
          Constructs a HslColor from 
color.factory - HslColor.fromHex(String hex)
 - 
          Constructs a HslColor from a RGB 
hexcolor.factory - 
          HslColor.fromList(List<
num> values) - 
          Constructs a HslColor from a list of 
hslvalues.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
- a → double
 - 
  The alpha channel of this color.
  finalinherited
 - alpha → int
 - 
  The alpha value of this color.
  finalinherited
 - b → double
 - 
  The blue channel of this color.
  finalinherited
 - blue → int
 - 
  The blue value of this color.
  no setterinherited
 - chroma → double
 - 
  Calculates a value representing this color's lightness on a linear scale.
  no setterinherited
 - colorSpace → ColorSpace
 - 
  The color space of this color.
  finalinherited
 - g → double
 - 
  The green channel of this color.
  finalinherited
 - green → int
 - 
  The green value of this color.
  no setterinherited
 - hashCode → int
 - 
  The hash code for this object.
  no setterinherited
 - hex → String
 - 
  Returns 
thisas a hexidecimal string.no setterinherited - hue → num
 - 
  The hue value of this color.
  finalinherited
 - inverted → HslColor
 - 
  Adjusts this colors hue by 
180degrees while inverting the saturation and lightness values.no setter - isBlack → bool
 - 
  Returns 
trueif this color is pure black.no setterinherited - isMonochromatic → bool
 - 
  Returns 
trueif this color is monochromatic.no setterinherited - isWhite → bool
 - 
  Returns 
trueif this color is pure white.no setterinherited - lightness → num
 - 
  The lightness value of this color.
  finalinherited
 - opacity → double
 - 
  The 
alphavalue as a double normalized to a0.0to1.0range.no setterinherited - opposite → HslColor
 - 
  Returns the color with the hue opposite of this colors'.
  no setter
 - r → double
 - 
  The red channel of this color.
  finalinherited
 - red → int
 - 
  The red value of this color.
  no setterinherited
 - runtimeType → Type
 - 
  A representation of the runtime type of the object.
  no setterinherited
 - saturation → num
 - 
  The saturation value of this color.
  finalinherited
 - value → int
 - 
  A 32 bit value representing this color.
  no setteroverride
 
Methods
- 
  castTo(
ColorModel other) → ColorModel  - 
  Converts this color to 
other's color space.inherited - 
  computeLuminance(
) → double  - 
  Returns a brightness value between 0 for darkest and 1 for lightest.
  inherited
 - 
  convert(
ColorModel other) → HslColor  - 
  Converts 
otherto this color's color space. - 
  cooler(
num amount, {bool relative = true}) → HslColor  - 
  Adjusts the hue of this color by 
amounttowards270degrees, capping the value at270. - 
  copyWith(
{num? hue, num? saturation, num? lightness, int? alpha}) → HslColor  - Returns a copy of this color modified with the provided values.
 - 
  distanceTo(
ColorModel color) → double  - 
  Returns the distance between 
thiscolor's hue andcolor's hue in degrees.inherited - 
  equals(
ColorModel color) → bool  - 
  Compares colors in the RGB color space.
  inherited
 - 
  interpolate(
Color end, double step) → Color  - 
      
Available on Color, provided by the LerpToColor extension
Interpolates to the definedstepbetween this color andend. - 
  interpolate(
ColorModel end, double step) → HslColor  - 
  Interpolates to 
stepbetweenthisandend. - 
  lerpTo(
ColorModel color, int steps, {ColorSpace? colorSpace, bool excludeOriginalColors = false}) → List< HslColor>  - 
  Returns the interpolated 
stepsbetween this color andcolor. - 
  lerpTo(
Color color, int steps, {ColorSpace? colorSpace, bool excludeOriginalColors = false}) → List< Color>  - 
      
Available on Color, provided by the LerpToColor extension
Returns the interpolatedstepsbetween this color andcolor. - 
  noSuchMethod(
Invocation invocation) → dynamic  - 
  Invoked when a nonexistent method or property is accessed.
  inherited
 - 
  rotateHue(
num amount) → HslColor  - 
  Rotates the hue of this color by 
amountin degrees. - 
  rotateHueRad(
double amount) → HslColor  - 
  Rotates the hue of this color by 
amountin radians. - 
  toARGB32(
) → int  - 
  Returns a 32-bit value representing this color.
  inherited
 - 
  toCmykColor(
) → CmykColor  - 
      
Available on Color, provided by the ToColorModel extension
Returns this color as a CmykColor. - 
  toCmykColor(
) → CmykColor  - 
  Converts 
thisto the CMYK color space.inherited - 
  toColor(
) → Color  - 
      
Available on ColorModel, provided by the ToColor extension
Returnsthisas a Color, converting the color to RGB if necessary. - 
  toColorModel(
) → ColorModel  - 
      
Available on Color, provided by the ToColorModel extension
Ifthisis a ColorModel, returnthis, otherwise construct a new RgbColor from this Color. - 
  toFactoredList(
) → List< double>  - 
  Returns a fixed-length list containing the 
hue,saturation, andlightnessvalues factored to be on 0 to 1 scale.inherited - 
  toFactoredListWithAlpha(
) → List< double>  - 
  Returns a fixed-length list containing the 
hue,saturation,lightness, andalphavalues factored to be on 0 to 1 scale.inherited - 
  toHsbColor(
) → HsbColor  - 
  Converts 
thisto the HSV color space.inherited - 
  toHsbColor(
) → HsbColor  - 
      
Available on Color, provided by the ToColorModel extension
Returns this color as a HsbColor. - 
  toHsiColor(
) → HsiColor  - 
  Converts 
thisto the HSI color space.inherited - 
  toHsiColor(
) → HsiColor  - 
      
Available on Color, provided by the ToColorModel extension
Returns this color as a HsiColor. - 
  toHslColor(
) → HslColor  - 
  Converts 
thisto the HSL color space. - 
  toHslColor(
) → HslColor  - 
      
Available on Color, provided by the ToColorModel extension
Returns this color as a HslColor. - 
  toHspColor(
) → HspColor  - 
  Converts 
thisto the HSP color space.inherited - 
  toHspColor(
) → HspColor  - 
      
Available on Color, provided by the ToColorModel extension
Returns this color as a HspColor. - 
  toLabColor(
) → LabColor  - 
  Converts 
thisto the LAB color space.inherited - 
  toLabColor(
) → LabColor  - 
      
Available on Color, provided by the ToColorModel extension
Returns this color as a LabColor. - 
  toList(
) → List< num>  - 
  Returns a fixed-length list containing the 
hue,saturation, andlightnessvalues, in that order.inherited - 
  toListWithAlpha(
) → List< num>  - 
  Returns a fixed-length list containing the 
hue,saturation,lightness, andalphavalues, in that order.inherited - 
  toOklabColor(
) → OklabColor  - 
  Converts 
thisto the Oklab color space.inherited - 
  toOklabColor(
) → OklabColor  - 
      
Available on Color, provided by the ToColorModel extension
Returns this color as an OklabColor. - 
  toRgbColor(
) → RgbColor  - 
  Converts 
thisto the RGB color space.inherited - 
  toRgbColor(
) → RgbColor  - 
      
Available on Color, provided by the ToColorModel extension
Returns this color as a RgbColor. - 
  toString(
) → String  - 
  A string representation of this object.
  inherited
 - 
  toXyzColor(
) → XyzColor  - 
  Converts 
thisto the XYZ color space.inherited - 
  toXyzColor(
) → XyzColor  - 
      
Available on Color, provided by the ToColorModel extension
Returns this color as a XyzColor. - 
  warmer(
num amount, {bool relative = true}) → HslColor  - 
  Adjusts the hue of this color by 
amounttowards90degrees, capping the value at90. - 
  withAlpha(
int alpha) → HslColor  - 
  Returns this 
HslColormodified with the providedalphavalue. - 
  withBlue(
num blue) → HslColor  - 
  Returns a new color that matches this color with the blue channel replaced
with 
b(which ranges from 0 to 255).override - 
  withChroma(
double chroma) → HslColor  - 
  Converts this color to the Oklab color space, calculates and
applies a new lightness value from the proivded 
chromavalue, and converts it back to the original color space. - 
  withGreen(
num green) → HslColor  - 
  Returns a new color that matches this color with the green channel
replaced with 
g(which ranges from 0 to 255).override - 
  withHue(
num hue) → HslColor  - 
  Returns this 
HslColormodified with the providedhuevalue. - 
  withOpacity(
double opacity) → HslColor  - 
  Returns this 
ColorModelwith the providedopacityvalue. - 
  withRed(
num red) → HslColor  - 
  Returns a new color that matches this color with the red channel replaced
with 
r(which ranges from 0 to 255).override - 
  withValues(
List< num> values) → HslColor - Returns a color in this color's color space with the values provided.
 
Operators
- 
  operator ==(
Object other) → bool  - 
  The equality operator.
  inherited