behavior ThemeSwitcher on load set userPreference to localStorage.theme if userPreference set the @data-bs-theme of the body to userPreference exit end if window.matchMedia('(prefers-color-scheme: dark)').matches put "" into me set the @data-bs-theme of the body to "dark" else put "" into me set the @data-bs-theme of the body to "light" end end on click if @data-bs-theme of the body is "dark" set the @data-bs-theme of the body to "light" set localStorage.theme to "light" else set the @data-bs-theme of the body to "dark" set localStorage.theme to "dark" end end on mutation of @data-bs-theme from body if @data-bs-theme of the body is "dark" put "" into me else put "" into me end end end