Function hexToRgba

  • Namespace

    StringUtils

    Convert a hexadecimal color code to RGBA format.

    Parameters

    • hex: string

      The hexadecimal color code (e.g., "#RRGGBB" or "#RRGGBBAA").

    Returns string

    The RGBA color code (e.g., "rgba(255, 0, 0, 0.5)").

    Example

    const hexColor = "#FF0000";
    const rgbaColor = hexToRgba(hexColor); // Output: "rgba(255, 0, 0, 1)"

Generated using TypeDoc