Skip to content

Commit

Permalink
attempt to fix the white blink
Browse files Browse the repository at this point in the history
  • Loading branch information
djdjz7 committed Dec 24, 2024
1 parent ca8acca commit d272986
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/App.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script setup lang="ts">
import MainComponent from './components/MainComponent.vue'
import { useDark } from '@vueuse/core'
useDark()
// import { useDark } from '@vueuse/core'
// useDark()
</script>

<template>
Expand Down
20 changes: 19 additions & 1 deletion src/assets/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ body {
'Open Sans',
'Helvetica Neue',
sans-serif;
color: var(--text-color, #000);
font-feature-settings:
'liga' 1,
'calt' 1; /* fix for Chrome */
Expand Down Expand Up @@ -88,3 +87,22 @@ img {
*::-webkit-scrollbar-thumb {
--at-apply: bg-gray-200 'dark:bg-dark-100' rounded-full;
}

@media (prefers-color-scheme: dark) {
body {
}
.shiki,
.shiki span {
color: var(--shiki-dark) !important;
background-color: var(--shiki-dark-bg) !important;
/* Optional, if you also want font styles */
font-style: var(--shiki-dark-font-style) !important;
font-weight: var(--shiki-dark-font-weight) !important;
text-decoration: var(--shiki-dark-text-decoration) !important;
}
:root {
color: var(--text-color);
--bg-color: #121212;
--text-color: #fff;
}
}
4 changes: 2 additions & 2 deletions src/components/AutoDarkImage.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { useDark } from '@vueuse/core'
import { usePreferredDark } from '@vueuse/core'
import { onMounted, ref, watch } from 'vue'
const props = defineProps<{
src: string
Expand All @@ -8,7 +8,7 @@ const props = defineProps<{
}>()
const url = ref('')
const isDark = useDark()
const isDark = usePreferredDark()
onMounted(() => {
watch(
isDark,
Expand Down
2 changes: 1 addition & 1 deletion uno.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { defineConfig, presetAttributify, presetUno, transformerDirectives } fro
export default defineConfig({
presets: [
presetUno({
dark: 'class',
dark: 'media',
}),
presetAttributify(),
],
Expand Down

0 comments on commit d272986

Please sign in to comment.