Function rgbaToHex

  • Namespace

    StringUtils

    Convert an RGBA color code to hexadecimal format.

    Parameters

    • rgba: string

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

    Returns string

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

    Example

    const rgbaColor = "rgba(255, 0, 0, 0.5)";
    const hexColor = rgbaToHex(rgbaColor); // Output: "#FF000080"

Generated using TypeDoc