Closed ValentinaKozlova closed 2 weeks ago
Package & Exports | Baseline (minified/GZIP) | PR | Change |
---|---|---|---|
react-swatch-picker-preview @fluentui/react-swatch-picker-preview - package |
109.013 kB 30.362 kB |
109.288 kB 30.485 kB |
275 B 123 B |
🤖 This report was generated against 79b73d920ef1a89e5daff165f28f0afe966afb01
This pull request is automatically built and testable in CodeSandbox.
To see build info of the built libraries, click here or the icon next to each commit SHA.
- Let's ensure that we have the best possible behavior built-in, at least for
ColorSwatch
it seems to be achievableWe need to have color computations under
useEffect
(probablyuseLayoutEffect()
to avoid flickering)
- I would propose something like that (we will avoid state updates i.e. re-renders 👍 ):
const { color } = props const ref = React.useRef(); React.useLayoutEffect(() => { const constrastColor = DO_SOMETHING(color); ref.current.style.setProperty('--fui-switch-SMTH', constrastColor); }, [color])
- We need to handle scenarios with CSS variables
- We need more powerful color parsing to handle cases not only for
rgb()
or HEX values. color-parse looks promising (5kb minified)
Yeah, it's a good idea. We'll add those after going stable
New Behavior
Added contrast utils and testsdisabled
iconAdded example with low contrast colors