vikramlearning / blazorbootstrap

An Enterprise-class Blazor Bootstrap Component library built on the Blazor and Bootstrap CSS frameworks.
https://docs.blazorbootstrap.com/
Apache License 2.0
565 stars 15 forks source link

Darkmode #651

Open maxdnet opened 2 months ago

maxdnet commented 2 months ago

Discussed in https://github.com/vikramlearning/blazorbootstrap/discussions/466

Originally posted by **ecospecifier** December 12, 2023 With bootstrap 5.3 will we see Blazor Bootstrap embrace darkmode firstclass? I notce a lot of components like eg. toasts don't respect the darkmode class on the body of the parent.
sikora507 commented 1 month ago

There is even a dark/light mode switch on blazorBootstrap docs site https://docs.blazorbootstrap.com/ Before the feature is implemented, can we know how this was done? It looks similar to how bootstrap 5.3 handles darkmode but the attribute name is slightly different: image How this is done with Blazor? When I tried to implement it myself using webassembly component to write to localstorage and use immediately invoked function expression to set the proper theme on page render, it works when I refresh the page, but when I navigate through links, the attribute keeps disappearing, and turns on the default light mode

Lucasharskamp commented 1 month ago

I agree that this is a sorely needed feature, plus the necessary documentation to get it easily up and running in our projects. Would make life a lot easier.