Skip to content

Commit 8d71576

Browse files
committed
chore: add DarkToggle in playground
1 parent 4b70ca4 commit 8d71576

File tree

3 files changed

+24
-3
lines changed

3 files changed

+24
-3
lines changed

packages/playground/basic/src/App.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script setup lang="ts">
2-
2+
import DarkToggle from './components/DarkToggle.vue'
33
</script>
44

55
<template>
@@ -27,5 +27,8 @@
2727
</span>
2828
</RouterLink>
2929
</div>
30+
<div text-center>
31+
<DarkToggle />
32+
</div>
3033
</div>
3134
</template>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<script setup lang="ts">
2+
import { useDark } from '@vueuse/core'
3+
4+
const isDark = useDark()
5+
</script>
6+
7+
<template>
8+
<button @click="isDark = !isDark">
9+
toggle dark mode
10+
</button>
11+
<div>isDark: {{ isDark }}</div>
12+
</template>

packages/playground/basic/src/style.css

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,19 @@
44
line-height: 24px;
55
font-weight: 400;
66

7-
color-scheme: light dark;
7+
/* color-scheme: light dark;
88
color: rgba(255, 255, 255, 0.87);
9-
background-color: #242424;
9+
background-color: #242424; */
1010

1111
font-synthesis: none;
1212
text-rendering: optimizeLegibility;
1313
-webkit-font-smoothing: antialiased;
1414
-moz-osx-font-smoothing: grayscale;
1515
-webkit-text-size-adjust: 100%;
1616
}
17+
18+
html.dark {
19+
color-scheme: dark;
20+
color: rgba(255, 255, 255, 0.87);
21+
background-color: #242424;
22+
}

0 commit comments

Comments
 (0)