Skip to content

docs: dark mode not applied properly in landing page #2093

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 28, 2025
Merged
Show file tree
Hide file tree
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
6 changes: 0 additions & 6 deletions .vitepress/theme/styles/landing.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,11 @@

html:has(.landing) {
--vp-c-bg: #101010;

background-color: #101010;

body {
background-color: #101010;
}
}

.landing {
overflow-x: hidden;
background-color: #101010;

* {
-webkit-font-smoothing: antialiased !important;
Expand Down
15 changes: 15 additions & 0 deletions index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
---
title: Vite
titleTemplate: 次世代フロントエンドツール
# add `dark` here to apply dark mode on initial load,
# since `onMounted` doesn't run during SSR
pageClass: landing dark

layout: home
Expand All @@ -10,6 +12,9 @@ markdownStyles: false
---

<script setup>
import { useData } from 'vitepress'
import { onBeforeUnmount, onMounted, ref } from 'vue'

import Hero from '.vitepress/theme/components/landing/1. hero-section/HeroSection.vue'
import FeatureSection from './.vitepress/theme/components/landing/2. feature-section/FeatureSection.vue'
import FrameworksSection from './.vitepress/theme/components/landing/3. frameworks-section/FrameworksSection.vue'
Expand All @@ -24,6 +29,16 @@ import FeatureFlexiblePlugins from './.vitepress/theme/components/landing/2. fea
import FeatureTypedAPI from './.vitepress/theme/components/landing/2. feature-section/FeatureTypedAPI.vue'
import FeatureSSRSupport from './.vitepress/theme/components/landing/2. feature-section/FeatureSSRSupport.vue'
import FeatureCI from './.vitepress/theme/components/landing/2. feature-section/FeatureCI.vue'

const { isDark } = useData()

onMounted(() => {
document.documentElement.classList.add('dark')
})

onBeforeUnmount(() => {
document.documentElement.classList.toggle('dark', isDark.value)
})
</script>

<div class="VPHome">
Expand Down