Open oliviertassinari opened 2 weeks ago
Absolutely, it can follow Tailwind API. Will change the default selector to use class approach.
As a note: Tailwind default behavior is media
.
Tailwind default behavior is media.
I think this is great, I would advocate to do the same so it works in the configuration-less mode.
Steps to reproduce
I'm confused by this
getSelector
API:getColorSchemeSelector
so maybe the name should be merged. Now, I imagine we shouldn't confuse it with the helper developer would use to write conditional logic, e.g.theme.applyStyles('dark', {})
.https://github.com/mui/pigment-css/blob/e672e4b4ee36bb135d6d50fd805d15376f13d1cb/packages/pigment-css-react/src/utils/extendTheme.ts#L20-L35
https://github.com/mui/pigment-css/blob/e672e4b4ee36bb135d6d50fd805d15376f13d1cb/packages/pigment-css-react/src/utils/extendTheme.ts#L150-L155
getSelector: (colorScheme) => colorScheme ? `.theme-${colorScheme}` : ':root',
. So, wouldn't it be better to match Tailwind CSS API? https://tailwindcss.com/docs/dark-mode#toggling-dark-mode-manually. I would propose something like this:Context
As a side note:
https://github.com/mui/pigment-css/blob/e672e4b4ee36bb135d6d50fd805d15376f13d1cb/packages/pigment-css-react/src/utils/extendTheme.ts#L104
https://github.com/mui/pigment-css/blob/e672e4b4ee36bb135d6d50fd805d15376f13d1cb/apps/pigment-css-next-app/next.config.js#L84
but the expected type is a string: https://github.com/mui/pigment-css/blob/e672e4b4ee36bb135d6d50fd805d15376f13d1cb/packages/pigment-css-react/src/utils/extendTheme.ts#L154
:hover
,:focus-visible
, etc styles.https://github.com/mui/pigment-css/blob/e672e4b4ee36bb135d6d50fd805d15376f13d1cb/README.md?plain=1#L667
This makes the case for why we need 1.
Your environment
``` Don't forget to mention which browser you used. Output from `npx @mui/envinfo` goes here. ```npx @mui/envinfo
Search keywords: -