This commit is contained in:
2023-05-10 22:18:22 +02:00
parent fed5006110
commit 9703d24784
14 changed files with 283 additions and 42 deletions

View File

@@ -7,7 +7,7 @@ export const useThemeStore = defineStore(
() => {
const currentTheme = ref<Theme>(Themes[THEMES.RainbowTheme])
const currentColor = ref<ColorsTheme>(currentTheme.value.colors[0])
let intervalId: NodeJS.Timeout | null = null
const intervalId = ref<NodeJS.Timeout | null>(null)
const isAvailable = (next: Theme): boolean => {
if (!next.availability)
@@ -23,10 +23,10 @@ export const useThemeStore = defineStore(
}
const swapColor = () => {
if (intervalId !== null)
clearInterval(intervalId)
if (intervalId.value !== null)
clearInterval(intervalId.value)
intervalId = setInterval(() => {
intervalId.value = setInterval(() => {
const colors = currentTheme.value.colors
const currentIndex = colors.indexOf(currentColor.value)
const nextIndex = (currentIndex + 1) % colors.length