@versatiles/style
    Preparing search index...

    Class ColorAbstract

    Abstract class representing a color.

    Hierarchy (View Summary)

    Index

    Constructors

    Methods

    • Converts the color to an array of numbers.

      Returns number[]

      An array representing the color.

    • Converts the color to a hexadecimal string.

      Returns string

      The hexadecimal representation of the color.

    • Converts the color to a string representation.

      Returns string

      The 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 clone of the current color instance.

      Returns Color

      A new Color instance that is a clone of the current instance.

    • 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 fade value.

      Returns Color

      A new Color instance that is faded.

    • 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.

    • 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 of the color.

      Parameters

      • value: number

        The new hue value.

      Returns HSV

      A new HSV color with the hue set.

    • 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

    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.