A lightweight and flexible library for smooth theme transitions in your web applications.
use-transition-change-theme
is a simple and powerful library that allows you to implement smooth theme transitions in
your web
applications. Whether you're switching between light and dark modes or applying completely custom themes, this library
provides a seamless experience for your users.
- Vue Hooks API
- Smooth transitions between themes
- Easy to integrate and use
- Highly customizable
You can install use-transition-change-theme
via npm:
pnpm install use-transition-change-theme
Here’s a basic example of how to use use-transition-change-theme
:
import {useTransitionChangeTheme} from '@imccc/use-transition-change-theme'
const isDark = ref(false)
const setIsDark = (v: boolean) => isDark.value = v
const {toggleTheme} = useTransitionChangeTheme(isDark, setIsDark)
function handleToggleTheme(event: MouseEvent) {
toggleTheme({
clientX: event.clientX,
clientY: event.clientY,
duration: 600, // animation duration date [optional]
animation: 'ease-out' // animation type [optional]
})
}
<button @click="(event) => handleToggleTheme(event)">
</button>
This project is licensed under the MIT License. See the LICENSE file for details.