Custom CSS has no effect once a visitor toggles dark mode
What you are seeing
You have added custom CSS to your site, but it has no effect once a visitor toggles dark mode.
#Why it happens
The site’s built-in colour palette uses more specific selectors than a plain :root rule. If your CSS sets its overrides on a bare :root, the built-in palette wins and your changes never show.
#What to do
Write the light block as :root, :root.light and the dark block as :root.dark, instead of a bare :root. Add a rule for each mode you want to change, so your styles hold whichever mode a visitor picks.
/* Light mode */
:root,
:root.light {
/* your overrides */
}
/* Dark mode */
:root.dark {
/* your overrides */
}Custom CSS is in the site's Settings, under Custom CSS. In an empty editor, Start from an example gives you this pattern.
#Related
Theme's custom CSS or design tokens disappeared after saving Appearance
The theme is replaced wholesale on save; any client that sends a partial theme wipes the f
Password-protected site's sign-in button does nothing
Password sign-in needs JavaScript and modern browser crypto. With JavaScript off, the form
Other problems
The rest of this family.
Found it? Good.
