Skip to main content

HslColor Structure

Defines a color using the hue/saturation/lightness (HSL) model. This uses a cylindrical-coordinate representation of a color.

Definition

Namespace: Avalonia.Media
Assembly: Avalonia.Base (in Avalonia.Base.dll)

public readonly struct HslColor : IEquatable<HslColor>
View Source
InheritanceObjectValueType → HslColor
ImplementsIEquatable(HslColor)

Constructors

HslColor(Color)Initializes a new instance of the HslColor struct.
HslColor(Double, Double, Double, Double)Initializes a new instance of the HslColor struct.

Properties

AGets the Alpha (transparency) component in the range from 0..1 (percentage).
HGets the Hue component in the range from 0..360 (degrees). This is the color's location, in degrees, on a color wheel/circle from 0 to 360. Note that 360 is equivalent to 0 and will be adjusted automatically.
LGets the Lightness component in the range from 0..1 (percentage).
SGets the Saturation component in the range from 0..1 (percentage).

Methods

Equals(HslColor)Indicates whether the current object is equal to another object of the same type.
Equals(Object)Indicates whether this instance and a specified object are equal.
(Overrides ValueType.Equals(Object))
FromAhsl(Double, Double, Double, Double)Creates a new HslColor from individual color component values.
FromHsl(Double, Double, Double)Creates a new HslColor from individual color component values.
GetHashCode()Gets a hashcode for this object. Hashcode is not guaranteed to be unique.
(Overrides ValueType.GetHashCode())
GetType()Gets the Type of the current instance.
(Inherited from Object)
Parse(String)Parses an HSL color string.
ToHsv()Returns the HSV color model equivalent of this HSL color.
ToHsv(Double, Double, Double, Double)Converts the given HSLA color component values to their HSV color equivalent.
ToRgb()Returns the RGB color model equivalent of this HSL color.
ToRgb(Double, Double, Double, Double)Converts the given HSLA color component values to their RGB color equivalent.
ToString()Returns the fully qualified type name of this instance.
(Overrides ValueType.ToString())
TryParse(String, HslColor)Parses an HSL color string.

Operators

Equality(HslColor, HslColor)Indicates whether the values of two specified HslColor objects are equal.
Explicit(HslColor to Color)Explicit conversion from an HslColor to a Color.
Inequality(HslColor, HslColor)Indicates whether the values of two specified HslColor objects are not equal.

See Also

Reference

Avalonia.Media Namespace