@versatiles/style
    Preparing search index...

    Interface HSL

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

    interface HSL {
        a: number;
        h: number;
        l: number;
        s: number;
        asArray(): [number, number, number, number];
        asHex(): string;
        asHSL(): HSL;
        asHSV(): HSV;
        asRGB(): RGB;
        asString(): string;
        blend(value: number, blendColor: Color): RGB;
        brightness(value: number): RGB;
        clone(): HSL;
        contrast(value: number): RGB;
        darken(value: number): RGB;
        fade(value: number): HSL;
        gamma(value: number): RGB;
        invert(): RGB;
        invertLuminosity(): HSL;
        lighten(value: number): RGB;
        rotateHue(offset: number): HSL;
        round(): HSL;
        saturate(ratio: number): HSL;
        setHue(value: number): HSV;
        tint(value: number, tintColor: Color): RGB;
        toHSL(): HSL;
    }

    Hierarchy (View Summary)

    Index

    Methods

    • Returns the HSL color as an array of numbers.

      Returns [number, number, number, number]

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

    • Converts the color to a hexadecimal string.

      Returns string

      The hexadecimal representation of the color.

    • Returns the HSL color as a CSS-compatible string.

      Returns string

      A string representing the HSL color in CSS format.

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

      Returns HSL

      A new HSL color with the same components as 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.

    • Decreases the alpha (opacity) of the HSL color by a given value.

      Parameters

      • value: number

        The value by which to decrease the alpha.

      Returns HSL

      A new HSL color with decreased alpha.

    • 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 component of the HSL color by a given offset.

      Parameters

      • offset: number

        The amount to rotate the hue by, in degrees.

      Returns HSL

      A new HSL color with the hue rotated by the given offset.

    • Returns a new HSL color with rounded components.

      Returns HSL

      A new HSL color with rounded hue, saturation, lightness, and alpha components.

    • Increases the saturation of the HSL color by a given ratio.

      Parameters

      • ratio: number

        The ratio by which to increase the saturation.

      Returns HSL

      A new HSL color with increased saturation.

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

    l: number

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

    s: number

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