Skip to content

pantoken-root / renderers/react-markdown/src / isColorValue

Function: isColorValue() ​

isColorValue(value): boolean

Beta

True when a string is a standalone CSS color value (hex or a color function).

Parameters ​

value ​

string

Returns ​

boolean

Example ​

ts
import { isColorValue } from "@pantoken/react-markdown";

isColorValue("#03893D"); // true
isColorValue("oklch(0.7 0.1 200)"); // true
isColorValue("hello"); // false