HSLColour class

A colour described by hue, saturation and lightness, usable anywhere a Flutter HSLColor is expected.

HSL is handy for making lighter and darker shades: change lightness and keep the rest.

Inheritance
Implemented types
Available extensions

Constructors

HSLColour({double alpha = 1.0, double hue = 360, double saturation = 1.0, double lightness = 1})
Creates an HSL colour. With the defaults (lightness 1.0) the result is opaque white.
const
HSLColour.fromAHSL(double alpha, double hue, double saturation, double lightness)
Creates an HSL colour from opacity (0.0 to 1.0), hue (0 to 360), saturation (0.0 to 1.0) and lightness (0.0 to 1.0), in that order.
const
HSLColour.fromColor(Color color)
Converts a Flutter Color to HSL.
factory
HSLColour.fromColour(Colour color)
Converts a Colour to HSL.
factory
HSLColour.fromHSVColour(HSVColour hsv)
Converts an HSVColour to HSL.
factory

Properties

alpha → double
Alpha, from 0.0 to 1.0. The describes the transparency of the color. A value of 0.0 is fully transparent, and 1.0 is fully opaque.
final
hashCode → int
The hash code for this object.
no setteroverride
hue → double
Hue, from 0.0 to 360.0. Describes which color of the spectrum is represented. A value of 0.0 represents red, as does 360.0. Values in between go through all the hues representable in RGB. You can think of this as selecting which color filter is placed over a light.
final
lightness → double
Lightness, from 0.0 to 1.0. The lightness of a color describes how bright a color is. A value of 0.0 indicates black, and 1.0 indicates white. You can think of this as the intensity of the light behind the filter. As the lightness approaches 0.5, the colors get brighter and appear more saturated, and over 0.5, the colors start to become less saturated and approach white at 1.0.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
saturation → double
Saturation, from 0.0 to 1.0. This describes how colorful the color is. 0.0 implies a shade of grey (i.e. no pigment), and 1.0 implies a color as vibrant as that hue gets. You can think of this as the purity of the color filter over the light.
final
toHSLColour → HSLColour

Available on HSLColor, provided by the Hslcolour extension

This colour as an HSLColour.
no setter

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toColor() → Color
Returns this HSL color in RGB.
override
toColour() → Colour
This colour as an RGB Colour.
override
toHSL() → HSLColour
This colour as an HSLColour.
override
toHSV() → HSVColour
This colour as an HSVColour.
override
toString() → String
A string representation of this object.
override
withAlpha(double alpha) → HSLColour
Returns a copy of this color with the alpha parameter replaced with the given value.
override
withHue(double hue) → HSLColour
Returns a copy of this color with the hue parameter replaced with the given value.
override
withLightness(double lightness) → HSLColour
Returns a copy of this color with the lightness parameter replaced with the given value.
override
withSaturation(double saturation) → HSLColour
Returns a copy of this color with the saturation parameter replaced with the given value.
override

Operators

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

Static Methods

lerp(HSLColour? a, HSLColour? b, double t) → HSLColour?
Blends between a and b, where t is 0.0 for a and 1.0 for b.
override