mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 12:28:42 +00:00
fix(component): theme flickering (#5238)
Add color-scheme to html so that the web will use system scheme when scripts has not being loaded; Use `(prefers-color-scheme: dark)` so that the css vars do not defer load based on `data-theme`, which is set by next-themes (which is deferred).
This commit is contained in:
@@ -11,8 +11,12 @@ globalStyle('html', {
|
||||
vars: lightCssVariables,
|
||||
});
|
||||
|
||||
globalStyle('html[data-theme="dark"]', {
|
||||
vars: darkCssVariables,
|
||||
globalStyle('html', {
|
||||
'@media': {
|
||||
'(prefers-color-scheme: dark)': {
|
||||
vars: darkCssVariables,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
|
||||
Reference in New Issue
Block a user