@ascentbv/ts-common - v1.0.123
    Preparing search index...

    Class ColorUtilAbstract

    Index

    Constructors

    Methods

    • Converts a HEX color string to an RGB object. Supports shorthand (#abc) and full (#aabbcc) formats.

      Parameters

      • hex: string

        A HEX color string (e.g., "#ff0000" or "ff0000").

      Returns RGB

      An RGB object.

    • Converts an RGB object to a HEX color string.

      Parameters

      • rgb: RGB

        The RGB color object.

      Returns string

      A HEX string (e.g., "#aabbcc").

    • Linearly blends between two RGB colors.

      Parameters

      • c1: RGB

        The first color.

      • c2: RGB

        The second color.

      • t: number

        A value between 0 and 1 determining the blend weight.

      Returns RGB

      A new blended RGB color.

    • Alpha-blends two RGBA colors.

      Parameters

      • c1: RGB & { a: number }

        The base color with alpha.

      • c2: RGB & { a: number }

        The overlay color with alpha.

      Returns RGB

      The resulting RGB color after alpha blending.

    • Converts an RGB color to grayscale using luminosity method.

      Parameters

      • rgb: RGB

        The RGB color to convert.

      Returns RGB

      A grayscale RGB color.

    • Adjusts the brightness of an RGB color.

      Parameters

      • rgb: RGB

        The RGB color to adjust.

      • factor: number

        A factor between -1 (darker) and 1 (brighter).

      Returns RGB

      The adjusted RGB color.