Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions site/.vitepress/theme/components/T8Example.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
<div v-if="showCode" class="code-display">
<pre><code>{{ syntax }}</code></pre>
</div>
<div class="render-container" :class="containerClass" ref="container"></div>
<div class="render-container" :class="[containerClass, { light: !isDarkTheme }]" ref="container"></div>
</div>
</template>

<script setup lang="ts">
import { ref, onMounted, onBeforeUnmount } from 'vue';
import { ref, onMounted, onBeforeUnmount, computed } from 'vue';

const props = defineProps<{
syntax: string;
Expand All @@ -23,6 +23,11 @@ const container = ref<HTMLElement | null>(null);
const showCode = ref(false);
let textInstance: any = null;

// Determine if the theme is dark based on mode or containerClass
const isDarkTheme = computed(() => {
return props.mode === 'dark' || props.containerClass?.includes('dark');
});

onMounted(async () => {
if (!container.value) return;

Expand Down Expand Up @@ -138,6 +143,10 @@ onBeforeUnmount(() => {
background-color: var(--vp-c-bg);
}

.render-container.light {
background-color: #ffffff;
}

.render-container.dark {
background-color: #1a1a1a;
color: #ffffff;
Expand Down