-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FOUDT: Flash of Unstyled Dark Theme #7530
Comments
I faced this issue because dark theme in Quasar is made using JS. In SSR mode, CSS and HTML are rendered before JS is loaded. A way to solve this issue is to use So, instead of this: body.body--dark {
color: white;
background: hsl(0deg 0% 7%);
} It should be this: @media (prefers-color-scheme: dark) {
body {
color: white;
background: hsl(0deg 0% 7%);
}
} To add dark theme toggle, |
I encountered this issue today as well. // src-ssr/extension.js
function modifyResponseBody (req, res, next) {
var oldSend = res.send
res.send = function () {
let state = { settings: { isDark: false } }
try {
state = JSON.parse(JSON.parse(require('cookie').parse(req.headers.cookie || '').qs))
} catch (e) {}
if (state && state.settings && state.settings.isDark) {
arguments[0] = arguments[0].replace(/body--light/gm, 'body--dark')
}
oldSend.apply(res, arguments)
}
next()
}
module.exports.extendApp = function ({ app, ssr }) {
app.use(modifyResponseBody)
/*
Extend the parts of the express app that you
want to use with development server too.
Example: app.use(), app.get() etc
*/
} |
Not solved problems: - vmColor in DialogPlugin - classes in QStepper Once these are solved isDark can be removed.
Not solved problems: - vmColor in DialogPlugin - classes in QStepper Once these are solved isDark can be removed.
Not solved problems: - vmColor in DialogPlugin - classes in QStepper Once these are solved isDark can be removed.
oh wow cool |
Not solved problems: - vmColor in DialogPlugin - classes in QStepper Once these are solved isDark can be removed.
Not solved problems: - vmColor in DialogPlugin - classes in QStepper Once these are solved isDark can be removed.
Not solved problems: - vmColor in DialogPlugin - classes in QStepper Once these are solved isDark can be removed.
Not solved problems: - vmColor in DialogPlugin - classes in QStepper Once these are solved isDark can be removed.
Not solved problems: - vmColor in DialogPlugin - classes in QStepper Once these are solved isDark can be removed.
Not solved problems: - vmColor in DialogPlugin - classes in QStepper Once these are solved isDark can be removed.
Not solved problems: - vmColor in DialogPlugin - classes in QStepper Once these are solved isDark can be removed.
Not solved problems: - vmColor in DialogPlugin - classes in QStepper Once these are solved isDark can be removed.
Not solved problems: - vmColor in DialogPlugin - classes in QStepper Once these are solved isDark can be removed.
Not solved problems: - vmColor in DialogPlugin - classes in QStepper Once these are solved isDark can be removed.
Not solved problems: - vmColor in DialogPlugin - classes in QStepper Once these are solved isDark can be removed.
Not solved problems: - vmColor in DialogPlugin - classes in QStepper Once these are solved isDark can be removed.
Not solved problems: - vmColor in DialogPlugin - classes in QStepper Once these are solved isDark can be removed.
Not solved problems: - vmColor in DialogPlugin - classes in QStepper Once these are solved isDark can be removed.
Not solved problems: - vmColor in DialogPlugin - classes in QStepper Once these are solved isDark can be removed.
Not solved problems: - vmColor in DialogPlugin - classes in QStepper Once these are solved isDark can be removed.
Not solved problems: - vmColor in DialogPlugin - classes in QStepper Once these are solved isDark can be removed.
Not solved problems: - vmColor in DialogPlugin - classes in QStepper Once these are solved isDark can be removed.
Not solved problems: - vmColor in DialogPlugin - classes in QStepper Once these are solved isDark can be removed.
Not solved problems: - vmColor in DialogPlugin - classes in QStepper Once these are solved isDark can be removed.
Not solved problems: - vmColor in DialogPlugin - classes in QStepper Once these are solved isDark can be removed.
Describe the bug
FOUDT: Flash of Unstyled Dark Theme
Codepen/jsFiddle/Codesandbox: https://codesandbox.io/s/peaceful-spence-jmu5d
To Reproduce
Steps to reproduce the behavior using given sandbox:
(prefers-color-scheme: dark)
media query and turn it onExpected behavior
App is rendered in dark theme as initial render
Platform (please complete the following information):
OS: macOS Catalina 10.15.5 (19F101)
Node: >= 10.17.0
NPM: >= 6.13.4
Yarn: >= 1.19.1
Browsers: Chrome 84.0.4147.89, Safari 13.1.1 (15609.2.9.1.2)
The text was updated successfully, but these errors were encountered: