Function toHexString

  • Converts a hex number value to a hex string with customizable prefix.

    Example

    toHexString(16777215) // Returns '#ffffff'
    toHexString(0, '0x') // Returns '#000000'

    Parameters

    • val: number

      Hex number value.

    • prefix: HexStringPrefix = '#'

      Output string prefix.

    Returns string

    Converted hex string.