ColorHSB

References
public struct ColorHSB : IEquatable<ColorHSB>
Color representation in HSB color model
Remarks: This allows you to manage a color in the HSB (otherwise known as HSV) cylindrical model. This is a helper class to handle HSB colors. Whenever a color is used it must be converted to a Color struct first, either by using ToColor() or the implicit conversion.

Constructors

ColorHSB

#
public ColorHSB(Color color)
Initializes a new instance of the ColorHSB class with the same color values as color

ColorHSB

#
public ColorHSB(float hue, float saturation, float brightness, float alpha = 1)
Initializes a new instance of the ColorHSB class
hue (float)Hue component (0-360)
saturation (float)Saturation component (0-1)
brightness (float)Brightness component (0-1)
alpha (float = 1)Alpha component (0-1)

Properties

Methods

Distance

#
public static float Distance(ColorHSB value1, ColorHSB value2)
Calculates the 'distance' of two HSB colors
Remarks: This is useful for comparing two different color values to determine if they are similar. Typically though, ColorHSL.Distance(ColorHSL, ColorHSL) gives the best result instead of this method.
value1 (ColorHSB)First color to compare
value2 (ColorHSB)Second color to compare
The overall distance/difference between the two colours. A lower value indicates a closer match

Equals

#
public bool Equals(ColorHSB other)
Compares a ColorHSB for equality
other (ColorHSB)Other instance to compare with
True if other is equal to this instance's value, false otherwise

Equals

#
public override bool Equals(object obj)
Compares an object to determine equality with this instance
obj (object)Object to compare
True if the object is equal to this instance's value, false otherwise
ValueType.Equals

GetHashCode

#
public override int GetHashCode()
Gets the hash code for this object

ToColor

#
public Color ToColor()
Converts this instance to an equivalent RGB Color

Operators

OperationResultDescription
ColorHSB==ColorHSBboolCompares two instances of the ColorHSB for equality
ColorHSB!=ColorHSBboolCompares two instances of the ColorHSB for inequality

Convertors

OperationResultDescription
implicitColorHSBColorImplicitly converts from a ColorHSB to a Color
implicitColorColorHSBImplicitly converts from a Color to a ColorHSB