@versatiles/style
    Preparing search index...

    Interface RGB

    Represents an RGB color with optional alpha transparency.

    interface RGB {
        a: number;
        b: number;
        g: number;
        r: 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(): RGB;
        contrast(value: number): RGB;
        darken(ratio: number): RGB;
        fade(value: number): RGB;
        gamma(value: number): RGB;
        invert(): RGB;
        invertLuminosity(): HSL;
        lighten(ratio: number): RGB;
        rotateHue(offset: number): HSL;
        round(): RGB;
        saturate(ratio: number): HSL;
        setHue(value: number): HSV;
        tint(value: number, tintColor: Color): RGB;
        toRGB(): RGB;
    }

    Hierarchy (View Summary)

    Index

    Methods

    • Returns the RGB color as an array.

      Returns [number, number, number, number]

      An array containing the red, green, blue, and alpha components.

    • Returns the RGB color as a hexadecimal string.

      Returns string

      A string representation of the RGB color in hexadecimal format.

    • Returns the RGB color as a string.

      Returns string

      A string representation of the RGB color in either rgb or rgba format.

    • Blends the RGB color with another color.

      Parameters

      • value: number

        The blend value to apply.

      • blendColor: Color

        The color to blend with.

      Returns RGB

      A new RGB instance with the blended color.

    • Adjusts the brightness of the RGB color.

      Parameters

      • value: number

        The brightness value to apply.

      Returns RGB

      A new RGB instance with the adjusted brightness.

    • Adjusts the contrast of the RGB color.

      Parameters

      • value: number

        The contrast value to apply.

      Returns RGB

      A new RGB instance with the adjusted contrast.

    • Darkens the RGB color.

      Parameters

      • ratio: number

        The ratio to darken the color by.

      Returns RGB

      A new RGB instance with the darkened color.

    • Fades the RGB color by reducing its alpha value.

      Parameters

      • value: number

        The fade value to apply.

      Returns RGB

      A new RGB instance with the faded color.

    • Adjusts the gamma of the RGB color.

      Parameters

      • value: number

        The gamma value to apply.

      Returns RGB

      A new RGB instance with the adjusted gamma.

    • Lightens the RGB color.

      Parameters

      • ratio: number

        The ratio to lighten the color by.

      Returns RGB

      A new RGB instance with the lightened color.

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

    • Rounds the RGB color components to the nearest integer.

      Returns RGB

      A new RGB instance with rounded color values.

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

    • Tints the RGB color with another color.

      Parameters

      • value: number

        The tint value to apply.

      • tintColor: Color

        The color to use for tinting.

      Returns RGB

      A new RGB instance with the applied tint.

    Properties

    a: number

    Alpha component (0-1).

    b: number

    Blue component (0-255).

    g: number

    Green component (0-255).

    r: number

    Red component (0-255).