Files
AFFiNE-Mirror/packages/frontend/component/src/theme/theme.css.ts
T
Peng Xiao 5979162a5c 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).
2023-12-08 10:12:20 +00:00

27 lines
581 B
TypeScript

import { darkCssVariables, lightCssVariables } from '@toeverything/theme';
import { globalStyle } from '@vanilla-extract/css';
globalStyle('body', {
color: 'var(--affine-text-primary-color)',
fontFamily: 'var(--affine-font-family)',
fontSize: 'var(--affine-font-base)',
});
globalStyle('html', {
vars: lightCssVariables,
});
globalStyle('html', {
'@media': {
'(prefers-color-scheme: dark)': {
vars: darkCssVariables,
},
},
});
if (process.env.NODE_ENV === 'development') {
globalStyle('.undefined', {
border: '5px solid red !important',
});
}