Skip to main content

parseHex

Callable

  • parseHex(hex: string): string[] | null

  • Checks if the given string represents a valid hexadecimal color code.

    @example
    parseHex('#ffffff') // ['ff', 'ff', 'ff']

    Parameters

    • hex: string

      The hexadecimal color code to be validated.

    Returns string[] | null

    An array of matched values if the input is a valid hexadecimal color code, or null otherwise.