RayHsl class base

HSL color implementation with intuitive hue, saturation, and lightness controls.

Stored as high-precision doubles for optimal color accuracy.

Inheritance
Available extensions

Constructors

RayHsl({required double hue, required double saturation, required double lightness, double opacity = 1.0})
Creates a RayHsl from HSL components.
RayHsl.empty()
Creates a transparent black HSL color.
RayHsl.fromComponents(num hue, num saturation, num lightness, [num opacity = 1.0])
Creates a RayHsl from individual HSLO component values.
factory
RayHsl.fromJson(Map<String, dynamic> json)
Creates a RayHsl for JSON deserialization.
factory
RayHsl.fromList(List<num> values)
Creates a RayHsl from a list of component values.
factory

Properties

colorSpace ColorSpace
The color space used by this Ray implementation.
no setteroverride
hashCode int
The hash code for this object.
no setteroverride
hue double
The hue component in degrees (0.0-360.0).
no setter
inverse RayHsl
Returns the color with inverted color values, preserving opacity.
no setteroverride
lightness double
The lightness component (0.0-1.0).
no setter
luminance double
Returns the relative luminance of this HSL color.
no setteroverride
opacity double
The opacity of this color (0.0 = transparent, 1.0 = opaque).
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
saturation double
The saturation component (0.0-1.0).
no setter

Methods

hueDifference(RayHsl other) double
Calculates the signed hue difference (-180° to 180°) considering color wheel circularity.
hueDistance(RayHsl other) double
Calculates the absolute hue distance (0-180°) using shortest path on color wheel.
lerp(Ray other, double t) RayHsl
Linearly interpolates between this color and other.
override
lightnessDifference(RayHsl other) double
Calculates the signed lightness difference (other - this).
lightnessDistance(RayHsl other) double
Calculates the absolute lightness distance.
maxContrast(Ray a, Ray b) Ray
Returns the color (a or b) with the highest contrast to this color.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
saturationDifference(RayHsl other) double
Calculates the signed saturation difference (other - this).
saturationDistance(RayHsl other) double
Calculates the absolute saturation distance.
toColor() Color

Available on Ray, provided by the RayToFlutterColor extension

Converts this RayRgb8 to a Flutter Color.
toColorSpace<T extends Ray>() → T
Converts this color to a different color space.
inherited
toColorWithOpacity(double opacity) Color

Available on Ray, provided by the RayToFlutterColor extension

Converts this Ray to a Flutter Color with specific opacity.
toHsl() RayHsl
Converts this color to HSL representation.
override
toJson() Map<String, dynamic>
Returns the color as a JSON-serializable value.
override
toList() List<num>
Returns the color components as a list.
override
toOklab() RayOklab
Converts this color to Oklab representation.
override
toOklch() RayOklch
Converts this color to Oklch representation.
override
toRgb16() RayRgb16
Converts this color to 16-bit RGB representation.
override
toRgb8() RayRgb8
Converts this color to 8-bit RGB representation.
inherited
toString() String
A string representation of this object.
override
withHue(double hue) RayHsl
Creates a new RayHsl with different hue (normalized to 0.0-360.0).
withLightness(double lightness) RayHsl
Creates a new RayHsl with the same HS values but different lightness.
withOpacity(double opacity) RayHsl
Creates a new color with different opacity (0.0-1.0).
override
withSaturation(double saturation) RayHsl
Creates a new RayHsl with the same HL values but different saturation.

Operators

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

Static Methods

parse(String value) RayHsl
Parses a color string and returns a RayHsl.
override