Closed KelvinTee58 closed 7 months ago
check your tailwind.config.js/ts
what's the darkMode
value in there.
source code would be helpful
Hi,mactanxin.Thank you for your reply This's my tailwind.config.js/ts
module.exports = {
darkMode: ["class"],
safelist: ["dark"],
prefix: "",
content: [
'./pages/**/*.{ts,tsx,vue}',
'./components/**/*.{ts,tsx,vue}',
'./app/**/*.{ts,tsx,vue}',
'./src/**/*.{ts,tsx,vue}',
],
theme: {
...
},
plugins: [animate],
}
and this's my components.json
{
"$schema": "https://shadcn-vue.com/schema.json",
"style": "default",
"typescript": true,
"tailwind": {
"config": "tailwind.config.js",
"css": "src/assets/index.css",
"baseColor": "gray",
"cssVariables": true
},
"framework": "vite",
"aliases": {
"components": "@/components",
"utils": "@/lib/utils"
}
}
Did I miss something?
And I will make my code public. If you could take a look at the complete code, it would be great if it could help me. UCColorPresetEditer
I hope you have time to help me. Thank you very much.
@KelvinTee58
I checked your source
import { createApp } from "vue";
import App from "./App.vue";
// 自定义样式
// tailwindcss main css file path was wrong
import "./assets/index.css";
// with aliases
// import "@/assets/index.css";
import "./style.css";
const app = createApp(App);
// 路由
import router from "@/router/index.ts";
app.use(router);
app.mount("#app");
Your main tailwind CSS
files is in src/assets/index.css
but you was pointing to @/assets/styles/index.scss
Hi sadeghbarati. The problem has been resolved. Thank you for your help.
Please Help me everyone !!!
Thanks
Reproduction
Describe the bug
I'm developing using vue3+vite+ts. After installing vite according to the Installation guide, I proceeded with implementing dark mode. Upon clicking 'toggle theme', the HTML root element toggles its class between 'light' and 'dark'. However, the page itself doesn't switch to 'light' or 'dark', nor does it modify '@media (prefers-color-scheme: light)'.
When I switch between light and dark modes using the appearance settings on my Mac OS, it disregards the root element's class as either 'light' or 'dark'. Additionally, I've added the '@media (prefers-color-scheme: light)' CSS property. I'm wondering if the logic for dark mode in the current documentation is sufficient, or how can I need to modify my code to fix it the bug or what kind a part of the code I'm missing.
If you could take the time to help, it would be greatly appreciated!
System Info
Contributes