workflow: fix sfc playground persist light mode (#5999)

This commit is contained in:
Phan An 2022-05-25 04:11:54 +02:00 committed by GitHub
parent 109751abdd
commit 7487d50775
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -9,10 +9,10 @@
<script> <script>
// process shim for old versions of @vue/compiler-sfc dependency // process shim for old versions of @vue/compiler-sfc dependency
window.process = { env: {} } window.process = { env: {} }
const saved = localStorage.getItem('vue-sfc-playground-prefer-dark') const savedPreferDark = localStorage.getItem('vue-sfc-playground-prefer-dark')
if ( if (
saved !== 'false' || savedPreferDark === 'true' ||
window.matchMedia('(prefers-color-scheme: dark)').matches (!savedPreferDark && window.matchMedia('(prefers-color-scheme: dark)').matches)
) { ) {
document.documentElement.classList.add('dark') document.documentElement.classList.add('dark')
} }