From 0f86b87385375e5bd859e84d21f8b4f06b0a99e0 Mon Sep 17 00:00:00 2001 From: Benjamin Canac Date: Wed, 2 Oct 2024 15:31:33 +0200 Subject: [PATCH] feat(module): override `dark` variant with class strategy --- src/runtime/index.css | 2 ++ src/runtime/plugins/colors.ts | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/runtime/index.css b/src/runtime/index.css index 29d363b9..034de704 100644 --- a/src/runtime/index.css +++ b/src/runtime/index.css @@ -49,6 +49,8 @@ --color-gray-950: var(--color-gray-950); } +@variant dark (&:where(.dark, .dark *)); + @layer base { :root { color-scheme: light dark; diff --git a/src/runtime/plugins/colors.ts b/src/runtime/plugins/colors.ts index 160f84fa..fbbd5ea8 100644 --- a/src/runtime/plugins/colors.ts +++ b/src/runtime/plugins/colors.ts @@ -18,7 +18,7 @@ export default defineNuxtPlugin(() => { ${Object.entries(appConfig.ui.colors).map(([key, value]: [string, string]) => generateColor(key, value)).join('\n ')} --color-primary-DEFAULT: var(--color-primary-500); } -@media (prefers-color-scheme: dark) { +.dark { --color-primary-DEFAULT: var(--color-primary-400); } `