diff --git a/src/components/ArticleWrapper.vue b/src/components/ArticleWrapper.vue index 500ac796..2f542901 100644 --- a/src/components/ArticleWrapper.vue +++ b/src/components/ArticleWrapper.vue @@ -1,6 +1,7 @@ @@ -34,9 +43,10 @@ const discusTheme = isDark.value ? 'dark' : 'light';
{{ (frontmatter.tags || []).map(x => `#${x}`).join(' ') }}
- + diff --git a/src/components/DarkMode.vue b/src/components/DarkMode.vue index ee02dee1..dec93d27 100644 --- a/src/components/DarkMode.vue +++ b/src/components/DarkMode.vue @@ -1,11 +1,10 @@ diff --git a/src/composables/dark.ts b/src/composables/dark.ts new file mode 100644 index 00000000..d4b4065d --- /dev/null +++ b/src/composables/dark.ts @@ -0,0 +1,14 @@ +const isDarkRef = ref(false); + +const isDark = useDark() +const toggleDark = useToggle(isDark) +isDarkRef.value = isDark.value; + +export function useMyDark() { + const toggleDarkWrapped = () => { + toggleDark(); + isDarkRef.value = isDark.value; + } + + return [isDarkRef, toggleDarkWrapped] as const; +} \ No newline at end of file