cmscss
April 13, 2026, 1:42pm
1
Sorry if this is easy but should the following pasted into a css snippet, override the background colour upon reload?
.theme-lighbody {
--background-primary: orange !important;
}
body {
--background-primary: orange !important;
}
Base colour scheme is set to light and the theme is set to default. Or is there some kind of cache? Have also tried relaunching Obsidian.
Found lots of closed answers but none that seem to work - and I couldn’t see anything in: CSS snippets - Obsidian Help
Any pointers in the right direction much appreciated.
Cheers, Ben
unxok
April 13, 2026, 7:36pm
2
You have a typo in the first selector, but the second selector will work (I tested it myself). Also, you don’t need those !important tags.
Here’s the corrected CSS with a selector each for light mode and dark mode. You can use either or both and obviously change the color to what you prefer.
body.theme-light {
--background-primary: red;
}
body.theme-dark {
--background-primary: orange;
}
But your initial selector should have somewhat worked, so if it didn’t for you, that means you probably didn’t enable it in your Appearance settings.
Settings > Appearance > CSS snippets > Click the toggle to enable for your snippet