usePreferredContrast
prefers-contrast media query
Usage
Live Editor
function Demo() { const contrast = usePreferredContrast(); return <div>PreferredContrast: {contrast}</div>; };
Result
Loading...
API
usePreferredContrast
Returns
Contrast
Arguments
Argument | Description | Type | DefaultValue |
---|---|---|---|
defaultState | default value | Contrast | undefined | no-preference |
Contrast
Type
export type Contrast = 'more' | 'less' | 'custom' | 'no-preference'