Function toRGBString

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

    Example

    toRGBString('#fff') // Returns 'rgb(255,255,255)'
    toRGBString('0x000', '0x') // Returns 'rgb(0,0,0)'

    Parameters

    • val: string | number

      Hex number/string representing a color.

    • prefix: HexStringPrefix = '#'

      Prefix of hex if using a string.

    Returns string

    RGB string.