Home About Github

$ npm i @barelyreaper/themer
      

// Example below is in React, but the library is framework agnostic
import {init,getCurrentTheme,setTheme} from "@barelyreaper/themer";

function App(){
    useEffect(()=>{
        const unsub = init()
        return unsub
    },[])

    const toggle = () => setTheme(getCurrentTheme()==="dark"?"light":"dark")

    return <>
        <button onClick="toggle">{getCurrentTheme()}</button>
    </>
}