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:
Logan.Li committed 2026-10-26 17:38:27 +08:00
1 parent a213d08e31
commit ac563d1c5e
7 files changed
+99 -223

No files matched your search

+21 -1
View File
@@ -65,9 +65,29 @@ export const statusColorMap: Record<string, string> = {
rollback: 'bg-orange-500/15 text-orange-400',
};
export const dbTypeColorMap: Record<string, string> = {
/**
* 数据库品牌色(刻意不随主题切换,是产品语义而非主题语义)
* 全站唯一源:徽章淡色版 dbTypeColorMap / 实色版 dbTypeBrandColorMap
*/
const DB_TYPE_BADGE = {
mysql: 'bg-[rgba(0,117,143,0.15)] text-[#26a69a]',
postgres: 'bg-[rgba(51,103,145,0.15)] text-[#42a5f5]',
redis: 'bg-[rgba(220,50,32,0.15)] text-[#ef5350]',
mongo: 'bg-[rgba(71,162,72,0.15)] text-[#66bb6a]',
};
export const dbTypeColorMap: Record<string, string> = {
...DB_TYPE_BADGE,
postgresql: DB_TYPE_BADGE.postgres,
pg: DB_TYPE_BADGE.postgres,
mongodb: DB_TYPE_BADGE.mongo,
};
export const dbTypeBrandColorMap: Record<string, string> = {
mysql: 'bg-[#00758f]',
postgres: 'bg-[#336791]',
postgresql: 'bg-[#336791]',
redis: 'bg-[#dc382d]',
mongo: 'bg-[#47a248]',
mongodb: 'bg-[#47a248]',
};