refactor(frontend): unify theme tokens to single --dg-* source
- remove shadcn HSL dual-track vars (523->416->~300 lines index.css); tailwind semantic colors (border/background/card/primary/destructive/ popover/muted/accent) now bridge directly to var(--dg-*) tokens - drop dead darkMode:['class'] config and inert dark: variants in kept ui components; theme switching is data-theme based (4 themes intact) - first-frame inline theme script in index.html (reads namespaced key with legacy fallback, resolves system, sets color-scheme) - no flash - consolidate duplicated db-type brand colors into lib/constants.ts single source (dbTypeColorMap + dbTypeBrandColorMap, with pg/mongodb aliases); instance health stroke now uses theme tokens - verified via browser: dark #0d1117 / light #f5f6f8 both resolve, tokens cascade correctly
This commit is contained in:
1 parent
a213d08e31
commit
ac563d1c5e
7 files changed
+99
-223
No files matched your search
+22
-50
@@ -1,55 +1,46 @@
|
||||
/** @type {import('tailwindcss').Config} */
|
||||
module.exports = {
|
||||
darkMode: ["class"],
|
||||
// 多主题经 data-theme 属性切换(--dg-* 单源),无 class 暗色模式
|
||||
content: ['./index.html', './src/**/*.{js,ts,jsx,tsx}'],
|
||||
theme: {
|
||||
extend: {
|
||||
colors: {
|
||||
border: "hsl(var(--border))",
|
||||
input: "hsl(var(--input))",
|
||||
ring: "hsl(var(--ring))",
|
||||
background: "hsl(var(--background))",
|
||||
foreground: "hsl(var(--foreground))",
|
||||
// 语义色全部派生自 --dg-* 设计 Token(唯一手写源)
|
||||
border: "var(--dg-border)",
|
||||
input: "var(--dg-border)",
|
||||
ring: "var(--dg-blue)",
|
||||
background: "var(--dg-bg-primary)",
|
||||
foreground: "var(--dg-text-primary)",
|
||||
primary: {
|
||||
DEFAULT: "hsl(var(--primary))",
|
||||
foreground: "hsl(var(--primary-foreground))",
|
||||
DEFAULT: "var(--dg-blue)",
|
||||
foreground: "#ffffff",
|
||||
},
|
||||
secondary: {
|
||||
DEFAULT: "hsl(var(--secondary))",
|
||||
foreground: "hsl(var(--secondary-foreground))",
|
||||
DEFAULT: "var(--dg-bg-tertiary)",
|
||||
foreground: "var(--dg-text-primary)",
|
||||
},
|
||||
destructive: {
|
||||
DEFAULT: "hsl(var(--destructive) / <alpha-value>)",
|
||||
foreground: "hsl(var(--destructive-foreground) / <alpha-value>)",
|
||||
DEFAULT: "var(--dg-red)",
|
||||
foreground: "#ffffff",
|
||||
},
|
||||
muted: {
|
||||
DEFAULT: "hsl(var(--muted))",
|
||||
foreground: "hsl(var(--muted-foreground))",
|
||||
DEFAULT: "var(--dg-bg-tertiary)",
|
||||
foreground: "var(--dg-text-muted)",
|
||||
},
|
||||
accent: {
|
||||
DEFAULT: "hsl(var(--accent))",
|
||||
foreground: "hsl(var(--accent-foreground))",
|
||||
DEFAULT: "var(--dg-bg-hover)",
|
||||
foreground: "var(--dg-text-primary)",
|
||||
},
|
||||
popover: {
|
||||
DEFAULT: "hsl(var(--popover))",
|
||||
foreground: "hsl(var(--popover-foreground))",
|
||||
DEFAULT: "var(--dg-bg-secondary)",
|
||||
foreground: "var(--dg-text-primary)",
|
||||
},
|
||||
card: {
|
||||
DEFAULT: "hsl(var(--card))",
|
||||
foreground: "hsl(var(--card-foreground))",
|
||||
},
|
||||
sidebar: {
|
||||
DEFAULT: "hsl(var(--sidebar-background))",
|
||||
foreground: "hsl(var(--sidebar-foreground))",
|
||||
primary: "hsl(var(--sidebar-primary))",
|
||||
"primary-foreground": "hsl(var(--sidebar-primary-foreground))",
|
||||
accent: "hsl(var(--sidebar-accent))",
|
||||
"accent-foreground": "hsl(var(--sidebar-accent-foreground))",
|
||||
border: "hsl(var(--sidebar-border))",
|
||||
ring: "hsl(var(--sidebar-ring))",
|
||||
DEFAULT: "var(--dg-bg-secondary)",
|
||||
foreground: "var(--dg-text-primary)",
|
||||
},
|
||||
},
|
||||
borderRadius: {
|
||||
borderRadius: {
|
||||
xl: "calc(var(--radius) + 4px)",
|
||||
lg: "var(--radius)",
|
||||
md: "calc(var(--radius) - 2px)",
|
||||
@@ -59,25 +50,6 @@ module.exports = {
|
||||
boxShadow: {
|
||||
xs: "0 1px 2px 0 rgb(0 0 0 / 0.05)",
|
||||
},
|
||||
keyframes: {
|
||||
"accordion-down": {
|
||||
from: { height: "0" },
|
||||
to: { height: "var(--radix-accordion-content-height)" },
|
||||
},
|
||||
"accordion-up": {
|
||||
from: { height: "var(--radix-accordion-content-height)" },
|
||||
to: { height: "0" },
|
||||
},
|
||||
"caret-blink": {
|
||||
"0%,70%,100%": { opacity: "1" },
|
||||
"20%,50%": { opacity: "0" },
|
||||
},
|
||||
},
|
||||
animation: {
|
||||
"accordion-down": "accordion-down 0.2s ease-out",
|
||||
"accordion-up": "accordion-up 0.2s ease-out",
|
||||
"caret-blink": "caret-blink 1.25s ease-out infinite",
|
||||
},
|
||||
},
|
||||
},
|
||||
plugins: [require("tailwindcss-animate")],
|
||||
|
||||
Reference in new issue
Block a user