Struct HSLA
A colour in HSL (Hue, Saturation, Lightness) form with an alpha component.
public readonly struct HSLA : IEquatable<HSLA>
- Implements
- Inherited Members
- Extension Methods
Constructors
HSLA(float, float, float, float)
Creates an HSLA with the given components without clamping or wrapping.
public HSLA(float hue, float saturation, float lightness, float alpha)
Parameters
Properties
a
Alpha.
public float a { get; init; }
Property Value
Remarks
This is intended to be in the inclusive range [0, 1]
, but can be outside.
h
Hue.
public float h { get; init; }
Property Value
Remarks
This is intended to be in the inclusive-exclusive range [0, 1)
, but can be outside.
l
Lightness.
public float l { get; init; }
Property Value
Remarks
This is intended to be in the inclusive range [0, 1]
, but can be outside.
s
Saturation.
public float s { get; init; }
Property Value
Remarks
This is intended to be in the inclusive range [0, 1]
, but can be outside.
Methods
Equals(HSLA)
public bool Equals(HSLA other)
Parameters
other
HSLA
Returns
Equals(HSLA, float)
Returns whether each component of other
differs from the corresponding component of this by <= tolerance
.
public bool Equals(HSLA other, float tolerance)
Parameters
Returns
Equals(object)
See Equals(HSLA).
public override bool Equals(object obj)
Parameters
obj
object
Returns
GetHashCode()
Returns the hash code for this instance.
public override int GetHashCode()
Returns
- int
A 32-bit signed integer that is the hash code for this instance.
ToString()
Returns the fully qualified type name of this instance.
public override string ToString()
Returns
- string
The fully qualified type name.
ToString(string)
Applies format
to each component.
public string ToString(string format)
Parameters
format
string
Returns
Operators
operator ==(HSLA, HSLA)
Component-wise equality.
public static bool operator ==(HSLA x, HSLA y)
Parameters
Returns
explicit operator HSLA(Color)
Converts from Color to HSLA.
public static explicit operator HSLA(Color rgba)
Parameters
rgba
Color
Returns
Remarks
Does not do any clamping.
This is independent of colour space.
explicit operator Color(HSLA)
Converts from HSLA to Color.
public static explicit operator Color(HSLA hsla)
Parameters
hsla
HSLA
Returns
- Color
Remarks
Does not do any clamping.
This is independent of colour space.
explicit operator HSL(HSLA)
public static explicit operator HSL(HSLA hsla)
Parameters
hsla
HSLA
Returns
explicit operator HSVA(HSLA)
public static explicit operator HSVA(HSLA hsla)
Parameters
hsla
HSLA
Returns
Remarks
Does not do any clamping.
This is independent of colour space.
operator !=(HSLA, HSLA)
public static bool operator !=(HSLA x, HSLA y)