Не подтверждена Коммит 5979162a создал по автору Peng Xiao's avatar Peng Xiao
Просмотр файлов

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).
владелец feed4004
...@@ -11,8 +11,12 @@ globalStyle('html', { ...@@ -11,8 +11,12 @@ globalStyle('html', {
vars: lightCssVariables, vars: lightCssVariables,
}); });
globalStyle('html[data-theme="dark"]', { globalStyle('html', {
vars: darkCssVariables, '@media': {
'(prefers-color-scheme: dark)': {
vars: darkCssVariables,
},
},
}); });
if (process.env.NODE_ENV === 'development') { if (process.env.NODE_ENV === 'development') {
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
<meta name="color-scheme" content="light dark" />
<meta <meta
name="viewport" name="viewport"
content="width=device-width, initial-scale=1, maximum-scale=1" content="width=device-width, initial-scale=1, maximum-scale=1"
......
Поддерживает Markdown
0% или .
You are about to add 0 people to the discussion. Proceed with caution.
Сначала завершите редактирование этого сообщения!
Пожалуйста, зарегистрируйтесь или чтобы прокомментировать