browserux-theme-switcher
Advanced tools
Changelog
[1.1.0] – 2025-07-02
<img class="has-dark">
sources based on the current theme.-dark
filename convention (e.g. logo.webp
→ logo-dark.webp
).data-src-light
and data-src-dark
attributes for full control.updateImagesByTheme()
and updateThemeImages()
utilities work together:
updateImagesByTheme()
applies filename-based switching for simple use cases.updateThemeImages()
enables fine-grained control via explicit attributes.Changelog
[1.0.3] – 2025-06-25
:host(.dark)
selector with a dynamic CSS variable (--toggle-shift
)
to control the toggle thumb position.Changelog
[1.0.2] – 2025-06-25
:host-context([data-theme="dark"])
selector.
.dark
class on <browserux-theme-switcher>
, enabling :host(.dark)
styling inside Shadow DOM for consistent theme behavior in Firefox.Changelog
[1.0.0] – 2025-06-14
<browserux-theme-switcher>
to toggle between light and dark themesprefers-color-scheme
)localStorage
lang
auto-detection or override, 9 built-in languages)aria-label
, customizable via data-label-*
--bux-switch-*
)no-shadow
)target
attribute.has-dark
classtheme-change
event triggered on every switchlight-icon
, dark-icon
)