{ "schemaVersion": 2, "sourceKind": "structured-spec", "confidence": "high", "slug": "themeswitcher", "family": "preference-switcher", "familyRole": "base", "familyParams": {"extra":"brand-palette","applyScope":"global"}, "name": "主题切换 ThemeSwitcher", "semanticTypeCandidates": [ "theme", "preference" ], "variantDimensions": [ { "name": "mode", "values": [ "light", "dark", "auto" ] }, { "name": "brandColor", "values": [ "#2F54EB", "#1677FF", "#722ED1", "#13C2C2", "#FA541C", "#EB2F96", "custom" ] } ], "representativeVariants": [ { "mode": "light", "brandColor": "#2F54EB", "label": "浅色 + 默认品牌蓝" }, { "mode": "dark", "brandColor": "#2F54EB", "label": "深色主题" }, { "mode": "auto", "brandColor": "custom", "label": "跟随系统 + 自定义品牌色" } ], "anatomy": { "mode": "日间 / 夜间 / 自动主题", "brand": "品牌色切换(6 预设 + 自定义)", "preview": "实时预览", "persist": "保存偏好(组件 kole-mode 存模式;文档站 kole-theme 存品牌色)" }, "structurePatterns": { "modes": "日间 / 夜间 / 自动", "brand": "6 预设色 + 自定义色板", "persist": "localStorage(见 unknowns 键名说明)" }, "usageHints": [ "明暗主题", "品牌色切换", "实时预览", "保存偏好", "适用于个性化" ], "doNotInvent": [ "暗色令牌的具体取值(见 colors_and_type.css 的 html.kole-dark)" ], "unknowns": [], "clarificationNotes": [ { "item": "预设品牌色清单", "kind": "decision", "meaning": "组件内置的 6 个品牌预设色。", "why": "H5/React/Vue2/Vue3 四端实现一致:#2F54EB #1677FF #722ED1 #13C2C2 #FA541C #EB2F96。", "decision": "拍板:升为正式契约;新增预设需同步四端实现与本契约。" }, { "item": "偏好保存的位置(localStorage 键名)", "kind": "decision", "meaning": "模式与品牌色的持久化键。", "why": "实现现状:组件端用 kole-mode 存 light/dark/auto;文档站用 kole-theme 存品牌色对象。", "decision": "拍板:按实现现状写入契约;组件宿主不得要求文档站键名,文档站不得要求组件读 kole-theme。" } ] }