@pbroom/color-kit/driverColor string input
parseColorStringInputValue
Parses any CSS color string parse accepts, returning null instead of throwing when it does not parse.
import { parseColorStringInputValue } from '@pbroom/color-kit/driver';color-string-input.ts:51function parseColorStringInputValue( value: string,): Color | null;Parameters
- value
string
Returns
Color | null
Example
import { toHex } from '@pbroom/color-kit';
import { parseColorStringInputValue } from '@pbroom/color-kit/driver';
toHex(parseColorStringInputValue('rebeccapurple')!); // → '#663399'
parseColorStringInputValue('#zzz'); // → null