Table of Contents

Struct HSVA

Namespace
PAC.Colour

A colour in HSV (Hue, Saturation, Value) form with an alpha component.

public readonly struct HSVA : IEquatable<HSVA>
Implements
Inherited Members
Extension Methods

Constructors

HSVA(float, float, float, float)

Creates an HSV with the given components without clamping or wrapping.

public HSVA(float hue, float saturation, float value, float alpha)

Parameters

hue float

See h.

saturation float

See s.

value float

See v.

alpha float

See a.

Properties

a

Alpha.

public float a { get; init; }

Property Value

float

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

float

Remarks

This is intended to be in the inclusive-exclusive range [0, 1), but can be outside.

s

Saturation.

public float s { get; init; }

Property Value

float

Remarks

This is intended to be in the inclusive range [0, 1], but can be outside.

v

Value.

public float v { get; init; }

Property Value

float

Remarks

This is intended to be in the inclusive range [0, 1], but can be outside.

Methods

Equals(HSVA)

public bool Equals(HSVA other)

Parameters

other HSVA

Returns

bool

Equals(HSVA, float)

Returns whether each component of other differs from the corresponding component of this by <= tolerance.

public bool Equals(HSVA other, float tolerance)

Parameters

other HSVA
tolerance float

Returns

bool

Equals(object)

public override bool Equals(object obj)

Parameters

obj object

Returns

bool

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

string

Operators

operator ==(HSVA, HSVA)

Component-wise equality.

public static bool operator ==(HSVA x, HSVA y)

Parameters

x HSVA
y HSVA

Returns

bool

explicit operator HSVA(Color)

Converts from Color to HSVA.

public static explicit operator HSVA(Color rgba)

Parameters

rgba Color

Returns

HSVA

Remarks

Does not do any clamping.

This is independent of colour space.

explicit operator Color(HSVA)

Converts from HSVA to Color.

public static explicit operator Color(HSVA hsva)

Parameters

hsva HSVA

Returns

Color

Remarks

Does not do any clamping.

This is independent of colour space.

explicit operator HSLA(HSVA)

Converts from HSVA to HSLA.

public static explicit operator HSLA(HSVA hsva)

Parameters

hsva HSVA

Returns

HSLA

Remarks

Does not do any clamping.

This is independent of colour space.

explicit operator HSV(HSVA)

Returns an HSV with the same HSV values as the HSVA, but discarding the alpha.

public static explicit operator HSV(HSVA hsva)

Parameters

hsva HSVA

Returns

HSV

operator !=(HSVA, HSVA)

public static bool operator !=(HSVA x, HSVA y)

Parameters

x HSVA
y HSVA

Returns

bool

See Also

HSV