Replies: 1 comment
|
Sorry this sat. I dug into both, and they are two different things — one is a missing script, the other is a real bug you found. 1. Not persisted — add the init scriptAdd this to <script src="_content/BlazorBlueprint.Components/js/theme-init.js"></script>It reads the stored theme and sets the class on It must stay a classic script rather than a module, or it runs too late and you get a flash of light first. Every demo host in the repo does this in 2.
|
Uh oh!
There was an error while loading. Please reload this page.
I have multiple issues with the dark mode at the moment.
Not persistent
I added the
BbDarkModeToggle, and it switches fine, but reloading or even changing the page (clicking an href) resets it back to light mode. Now I don't know whether the "link-clicking" happens because it's on my login pages, which are rendered differently, maybe that's the issue.Tailwind prefix not working
This is probably the one that bothers me the most. I do have Tailwind installed and run it while running the App, etc. And the docs say I could use
dark:prefix to only do some styling when dark mode is enabled, e.g. for gradients I would often usedark:bg-none, but doing that will simply enable thebg-nonealways, so also in light mode, which disables the gradient.If anyone has some suggestions or maybe a Demo project I could check out that gets this correctly, gladly lmk 🙏 Btw I mostly use
InteractiveServerRender-Mode, only my Login-Pages don't since they needHttpContext.All reactions