mirror of
https://github.com/luxfhe/example-blind-auction.git
synced 2026-10-30 18:13:37 +00:00
14 lines
372 B
TypeScript
14 lines
372 B
TypeScript
import { ref } from 'vue';
|
|
|
|
const dark = ref<boolean>(false); // Initial theme state with TypeScript type
|
|
|
|
export const useThemeToggle = () => {
|
|
const toggleTheme = () => {
|
|
dark.value = !dark.value;
|
|
document.documentElement.setAttribute('data-bs-theme', dark.value ? "dark" : "light");
|
|
console.log("Theme toggled!");
|
|
};
|
|
|
|
return { dark, toggleTheme };
|
|
};
|