Table of Contents

Struct HSV

Namespace
PAC.Colour

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

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

Constructors

HSV(float, float, float)

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

public HSV(float hue, float saturation, float value)

Parameters

hue float

See h.

saturation float

See s.

value float

See v.

Properties

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(HSV)

public bool Equals(HSV other)

Parameters

other HSV

Returns

bool

Equals(HSV, float)

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

public bool Equals(HSV other, float tolerance)

Parameters

other HSV
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

WithAlpha(float)

Returns an HSVA with the same HSV values and with the given alpha.

public HSVA WithAlpha(float alpha)

Parameters

alpha float

Returns

HSVA

Operators

operator ==(HSV, HSV)

Component-wise equality.

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

Parameters

x HSV
y HSV

Returns

bool

explicit operator HSL(HSV)

Converts from HSV to HSL.

public static explicit operator HSL(HSV hsv)

Parameters

hsv HSV

Returns

HSL

Remarks

Does not do any clamping.

This is independent of colour space.

explicit operator RGB(HSV)

Converts from HSV to RGB.

public static explicit operator RGB(HSV hsv)

Parameters

hsv HSV

Returns

RGB

Remarks

Does not do any clamping.

This is independent of colour space.

operator !=(HSV, HSV)

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

Parameters

x HSV
y HSV

Returns

bool

See Also