Table of Contents

**@arolariu/components**


@arolariu/components / isValidHexColor

Variable: isValidHexColor()

const isValidHexColor: (hexColor) => boolean = validateHexColorFormat

Defined in: lib/color-conversion-utilities.ts:159

Validates whether a string is a valid 6-digit hexadecimal color code.

Parameters

hexColor

string

String to validate

Returns

boolean

True if valid 6-digit hex color (with or without #)

Example

validateHexColorFormat("#06b6d4"); // true
validateHexColorFormat("06b6d4");  // true
validateHexColorFormat("#FFF");    // false (3-digit not supported)
validateHexColorFormat("invalid"); // false

Deprecated

Use validateHexColorFormat instead