Bootstrap 5.3 switches colours with <html data-bs-theme>. The theme store in @mintplayer/web-components/theming owns the user's choice, persists it in the bs-theme-mode cookie and resolves auto from prefers-color-scheme, live. BsThemeToggle and useBsTheme() are two views of that one store, shared with every other framework's adapter on the page.
modes: light and dark, in DutchThe button's name is the next action (“Switch to dark theme”), its description is the current state, and each click is announced. Enter and Space cycle it. More than about three modes wants a menu (a radio group) rather than a cycling button.
Mode auto, effective light.
The pre-boot script is generated from the same core as the store (ES5, under 1 KB). It runs before the stylesheets, so a dark user never sees a light frame: with or without SSR, and on cached or prerendered pages. The color-scheme meta themes native controls and scrollbars; the two theme-color metas tint the browser chrome.
Stock bootstrap.min.css has no --mp-color-mode token, which the components' dark select carets and switch knobs query through shadow roots. Import it beside Bootstrap:
Splice the attribute onto <html> on the server so even a visitor with JavaScript disabled gets their theme. A valid cookie wins (an explicit auto included), then the meta default, then auto, which renders no attribute. Invalid cookie values are ignored, so the result is always safe to splice.
bs-theme-mode: Path=/, SameSite=Lax, one year, Secure on https. Values match ^[a-z0-9-]{1,32}$; localStorage is never used.