nextui icon indicating copy to clipboard operation
nextui copied to clipboard

[BUG] - NextUIProvider color-scheme incorrect

Open jackyleefu opened this issue 3 years ago • 4 comments

Describe the bug

NextUIProvider: incorrect color-scheme value for style attribute of html element

Your Example Website or App

No response

Steps to Reproduce the Bug or Issue

the problem is nextui/packages/react/src/theme/utils.ts getThemeName last line: el?.setAttribute("style", clsx(prevStyles, color-scheme: ${theme};)); ==> el?.setAttribute("style", clsx(prevStyles, color-scheme: ${getThemeName(theme)};));

Expected behavior

color-scheme: dark; OR color-scheme: light; without -theme

Screenshots or Videos

屏幕截图 2022-08-26 153023 屏幕截图 2022-08-26 153237

屏幕截图 2022-08-26 153641

Operating System Version

OS: Windows

Browser

Chrome

jackyleefu avatar Aug 26 '22 07:08 jackyleefu

Hey @jackyleefu could you please create a repository/codesandbox? The ThemeType value its always dark / light so in theory, it should only put color-scheme: dark/light unless you call manually the changeTheme function with other theme value

jrgarciadev avatar Aug 28 '22 15:08 jrgarciadev

https://codesandbox.io/s/little-morning-6ub1i4?file=/src/index.js 屏幕截图 2022-08-29 084721

jackyleefu avatar Aug 29 '22 00:08 jackyleefu

Hey @jrgarciadev, createThemeBase() used default className(${type}-theme) in stitches.config.ts, so useEffect in ThemeProvider will changeTheme(userTheme.className);

jackyleefu avatar Aug 29 '22 01:08 jackyleefu

I can offer a PR @jrgarciadev

sun0day avatar Aug 31 '22 12:08 sun0day