(value: string | Color | undefined | null)
| 15 | import {useMemo} from 'react'; |
| 16 | |
| 17 | export function useColor(value: string | Color | undefined | null): Color | null | undefined { |
| 18 | return useMemo(() => { |
| 19 | if (typeof value === 'string') { |
| 20 | try { |
| 21 | return parseColor(value); |
| 22 | } catch { |
| 23 | return undefined; |
| 24 | } |
| 25 | } |
| 26 | return value; |
| 27 | }, [value]); |
| 28 | } |
no test coverage detected