diff --git a/src/ColorPreview.tsx b/src/ColorPreview.tsx index a0836b3..80ddc1f 100644 --- a/src/ColorPreview.tsx +++ b/src/ColorPreview.tsx @@ -4,12 +4,14 @@ interface ColorPreviewProps { color: string; } +const UNPARSABLE_COLOR_VALUES = ['inherit', 'initial', 'unset']; + // heuristic based on token name/scope and maybe even the format of the value export const isColor = (value: string): boolean => { // taken from https://stackoverflow.com/a/56266358/973537 const s = new Option().style; s.color = value; - return s.color !== ''; + return s.color !== '' && !UNPARSABLE_COLOR_VALUES.includes(s.color); }; const ColorPreview = ({color}: ColorPreviewProps): JSX.Element | null => { diff --git a/src/TokenRow.stories.mdx b/src/TokenRow.stories.mdx index 6750e5d..bfcf0a9 100644 --- a/src/TokenRow.stories.mdx +++ b/src/TokenRow.stories.mdx @@ -48,6 +48,28 @@ support this yet!_ +**CSS color properties** + + + + {Template.bind({})} + + + ## Props