Skip to content

Commit

Permalink
fix darkmode localstorage
Browse files Browse the repository at this point in the history
  • Loading branch information
YuichiSemura committed Apr 2, 2024
1 parent dce4260 commit 35ed366
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/components/Roulette.vue
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<script setup lang="ts">
import { TresCanvas, useRenderLoop } from '@tresjs/core';
import { computed, reactive, ref, watch, watchEffect } from 'vue';
import { computed, reactive, ref, watchEffect } from 'vue';
import { BasicShadowMap, SRGBColorSpace, NoToneMapping } from 'three';
import { OrbitControls, Text3D, Stars } from '@tresjs/cientos';
import { useControls } from '@tresjs/leches';
// 色の設定
const darkMode = ref(Boolean(localStorage.getItem("darkmode")) ?? false);
const darkMode = ref(Boolean(JSON.parse(localStorage.getItem("darkmode") ?? 'true')));
const colorTheme = computed(() => {
return darkMode.value ? 'dark' : 'light';
});
watch(darkMode, ()=>{
localStorage.setItem("darkmode", "true");
watchEffect(()=>{
localStorage.setItem("darkmode", String(darkMode.value));
})
const starRotationY = ref(0);
Expand Down

0 comments on commit 35ed366

Please sign in to comment.