Represents a color in the HSV (Hue, Saturation, Value) color space. Extends the base Color class.

Hierarchy (View Summary)

Constructors

  • Constructs a new HSV color.

    Parameters

    • h: number

      The hue component, in the range [0, 360].

    • s: number

      The saturation component, in the range [0, 100].

    • v: number

      The value (brightness) component, in the range [0, 100].

    • a: number = 1

      The alpha (opacity) component, in the range [0, 1]. Defaults to 1.

    Returns HSV

Methods

  • Returns the HSV color as an array of numbers.

    Returns [number, number, number, number]

    An array containing the hue, saturation, value, and alpha components.

  • Converts the color to a hexadecimal string.

    Returns string

    The hexadecimal representation of the color.

  • Returns the color as a string representation.

    Returns string

    A string representation of the color.

  • Blends the color with another color.

    Parameters

    • value: number

      The blend ratio.

    • blendColor: Color

      The color to blend with.

    Returns RGB

    A new RGB color that is blended.

  • Adjusts the brightness of the color.

    Parameters

    • value: number

      The brightness adjustment value.

    Returns RGB

    A new RGB color with adjusted brightness.

  • Creates a new HSV color that is a copy of the current color.

    Returns HSV

    A new HSV color that is a clone of the current color.

  • Adjusts the contrast of the color.

    Parameters

    • value: number

      The contrast adjustment value.

    Returns RGB

    A new RGB color with adjusted contrast.

  • Darkens the color by a given value.

    Parameters

    • value: number

      The amount to darken the color.

    Returns RGB

    A new RGB color that is darkened.

  • Fades the color by a given value.

    Parameters

    • value: number

      The amount to fade the color by, in the range [0, 1].

    Returns HSV

    A new HSV color with the alpha component faded by the given value.

  • Applies gamma correction to the color.

    Parameters

    • value: number

      The gamma correction value.

    Returns RGB

    A new RGB color with gamma correction applied.

  • Lightens the color by a given value.

    Parameters

    • value: number

      The amount to lighten the color.

    Returns RGB

    A new RGB color that is lightened.

  • Rotates the hue of the color by a given offset.

    Parameters

    • offset: number

      The amount to rotate the hue.

    Returns HSL

    A new HSL color with the hue rotated.

  • Returns a new HSV color with the components rounded to the nearest integer.

    Returns HSV

    A new HSV color with rounded components.

  • Saturates the color by a given ratio.

    Parameters

    • ratio: number

      The ratio to saturate the color.

    Returns HSL

    A new HSL color with increased saturation.

  • Sets the hue component of the color.

    Parameters

    • value: number

      The new hue value, in the range [0, 360].

    Returns HSV

    A new HSV color with the updated hue component.

  • Tints the color by blending it with another color.

    Parameters

    • value: number

      The blend ratio.

    • tintColor: Color

      The color to blend with.

    Returns RGB

    A new RGB color that is tinted.

Properties

a: number

The alpha (opacity) component of the color, in the range [0, 1].

h: number

The hue component of the color, in the range [0, 360].

s: number

The saturation component of the color, in the range [0, 100].

v: number

The value (brightness) component of the color, in the range [0, 100].

HSL: typeof HSL

The HSL color model.

HSV: typeof HSV

The HSV color model.

parse: (input: string | Color) => Color

Parses a color from a string or another Color instance.

Type declaration

    • (input: string | Color): Color
    • Parameters

      • input: string | Color

        The input color as a string or Color instance.

      Returns Color

      The parsed Color instance.

RGB: typeof RGB

The RGB color model.