/** PrimeVue 客户端统一配置:中文交互文案、蓝色主色以及 .app-dark 暗色切换。 */ import { definePreset } from "@primeuix/themes"; import Aura from "@primeuix/themes/aura"; import locale from "./locale.zh-CN.json"; // Use the MIT theme package, with the console's blue/slate/zinc palette. // 只覆盖 Aura 的语义色阶,保留组件自身设计令牌;浅色用 slate,深色用 zinc。 const preset = definePreset(Aura, { semantic: { primary: Object.fromEntries( [50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950].map((shade) => [ shade, `{blue.${shade}}`, ]), ), colorScheme: { light: { // 普通字号白字按钮至少4.5:1;浅色主色从blue-600起,hover/active继续加深,暗色令牌不变。 primary: { color: "{primary.600}", contrastColor: "#ffffff", hoverColor: "{primary.700}", activeColor: "{primary.800}", }, surface: Object.fromEntries( [0, 50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950].map( (shade) => [shade, shade === 0 ? "#ffffff" : `{slate.${shade}}`], ), ), }, dark: { surface: Object.fromEntries( [0, 50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950].map( (shade) => [shade, shade === 0 ? "#ffffff" : `{zinc.${shade}}`], ), ), }, }, }, }); export default { ripple: true, locale, theme: { preset, options: { darkModeSelector: ".app-dark" } }, };