Regex Patterns
Regex Patterns
Section titled “Regex Patterns”Pre-defined regular expression patterns for validating and parsing color strings.
Available Patterns
Section titled “Available Patterns”HEX_REGEX- Matches hexadecimal color values (#RGB or #RRGGBB)HSL_REGEX- Matches HSL/HSLA color stringsOKLCH_REGEX- Matches OKLCH color stringsRGB_REGEX- Matches RGB/RGBA color strings
Examples
Section titled “Examples”import { HEX_REGEX, RGB_REGEX } from 'huey/utils'
const isHex = HEX_REGEX.test('#ff0000') // trueconst isRgb = RGB_REGEX.test('rgb(255, 0, 0)') // truePattern Details
Section titled “Pattern Details”Each regex pattern is designed to:
- Validate proper color format syntax
- Extract color channel values
- Handle both with and without alpha channels (where applicable)