Table of Contents

Struct HsvColor

Namespace
BlazOrbit.Components
Assembly
BlazOrbit.Core.dll

Represents a color in HSV (Hue, Saturation, Value) color space. Used internally by the color picker component.

public readonly struct HsvColor

Constructors

HsvColor(int, double, double)

Creates an HSV color, clamping each component to its valid range.

public HsvColor(int hue, double saturation, double value)

Parameters

hue int
saturation double
value double

Properties

Hue

Hue in degrees (0–360).

public int Hue { get; }

Property Value

int

Saturation

Saturation (0–1).

public double Saturation { get; }

Property Value

double

Value

Value / brightness (0–1).

public double Value { get; }

Property Value

double

Methods

Equals(HsvColor)

public bool Equals(HsvColor other)

Parameters

other HsvColor

Returns

bool

Equals(object?)

public override bool Equals(object? obj)

Parameters

obj object

Returns

bool

FromCssColor(CssColor)

Converts an RGB CssColor to HSV.

public static HsvColor FromCssColor(CssColor color)

Parameters

color CssColor

Returns

HsvColor

GetHashCode()

public override int GetHashCode()

Returns

int

ToCssColor(byte)

Converts this HSV color back to a CssColor with the given alpha.

public CssColor ToCssColor(byte alpha = 255)

Parameters

alpha byte

Returns

CssColor

WithHue(int)

Returns a copy with the supplied hue.

public HsvColor WithHue(int hue)

Parameters

hue int

Returns

HsvColor

WithSaturation(double)

Returns a copy with the supplied saturation.

public HsvColor WithSaturation(double saturation)

Parameters

saturation double

Returns

HsvColor

WithValue(double)

Returns a copy with the supplied value/brightness.

public HsvColor WithValue(double value)

Parameters

value double

Returns

HsvColor

Operators

operator ==(HsvColor, HsvColor)

Equality operator with a small tolerance on saturation/value.

public static bool operator ==(HsvColor left, HsvColor right)

Parameters

left HsvColor
right HsvColor

Returns

bool

operator !=(HsvColor, HsvColor)

Inequality operator.

public static bool operator !=(HsvColor left, HsvColor right)

Parameters

left HsvColor
right HsvColor

Returns

bool