0.0.5 • Published 3 months ago

@v0xoss/use-theme v0.0.5

Weekly downloads
-
License
MIT
Repository
github
Last release
3 months ago

@v0xoss/use-theme

React hook to switch between light and dark themes

Installation

yarn add @v0xoss/use-theme
# or
npm i @v0xoss/use-theme

Usage

Import useTheme

import {useTheme} from "@v0xoss/use-theme";

theme

// `theme` is the active theme name
// by default, it will use the one in localStorage.
// if it is no such value in localStorage, `light` theme will be used
const {theme} = useTheme();

setTheme

You can use any theme name you want, but make sure it exists in your tailwind.config.js file. See Create Theme for more details.

// set `theme` by using `setTheme`
const {setTheme} = useTheme();
// setting to light theme
setTheme('light')
// setting to dark theme
setTheme('dark')
// setting to purple-dark theme
setTheme('purple-dark')

Contribution

Yes please! See the contributing guidelines for details.

License

This project is licensed under the terms of the MIT license.

0.0.5

3 months ago

0.0.4

3 months ago

0.0.3

3 months ago

0.0.2

3 months ago

0.0.1

3 months ago