Sha256: 08d3b754e797d797226536e13e2bb17a452b8cfabee6591afdaed694233420a1

Contents?: true

Size: 386 Bytes

Versions: 1

Compression:

Stored size: 386 Bytes

Contents

const setTheme = (theme) => {
  document.documentElement.setAttribute('data-theme', theme);
};
const initTheme = (t1, t2) => {
  document.getElementById(t1).addEventListener("click", () => {
    setTheme(t1);
    localStorage.setItem("theme", t1);
  });
};
const theme = localStorage.getItem("theme") || "light";
setTheme(theme);
initTheme("light", "dark");
initTheme("dark", "light");

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
another-theme-0.0.1 assets/js/main.js