nuxt-modules / color-mode

Dark and Light mode with auto detection made easy with Nuxt 🌗
https://color-mode.nuxtjs.org
MIT License
1.08k stars 99 forks source link

Dark theme cannot be loaded #216

Closed anhthang closed 6 months ago

anhthang commented 10 months ago

I'm using Vue ConfigProvider for theme like below sample code, but it seems not working well with colorMode module.

Light mode has no issue, But when the system preference is dark or I select dark mode, the styles is broken (see the image)

But It's working well when I set the theme algorithm is theme.darkAlgorithm

Version

@nuxtjs/color-mode: 3.3.0 nuxt: 3.8.0 ant-design-vue: 4.0.1

Reproduction Link

Screenshot 2023-10-24 at 18-23-28 Keebtalogue

Steps to reproduce

Here is my code sample

<template>
  <a-config-provider
    :theme="{
      algorithm:
        $colorMode.value === 'dark'
          ? theme.darkAlgorithm
          : theme.defaultAlgorithm,
    }"
  >
    <NuxtLayout>
      <NuxtPage />
    </NuxtLayout>
  </a-config-provider>
</template>
<script setup>
import { theme } from 'ant-design-vue'
</script>

What is Expected?

Dark theme working

What is actually happening?

Dark theme cannot be loaded