Function toRGBTuple

  • Converts a hex number/string representing a color to an RGB tuple.

    Example

    toRGBTuple('#fff') // Returns '[255, 255, 255]'
    toRGBTuple('0x000', '0x') // Returns '[0, 0, 0]'

    Parameters

    • val: string | number

      Hex number/string representing a color.

    • prefix: HexStringPrefix = '#'

      Prefix of hex if using a string.

    Returns RGBTuple

    RGB tuple in the format of [r, g, b].