From 9133761e39d2266c0f76096c3658bbbf2910203f Mon Sep 17 00:00:00 2001 From: tolking Date: Sat, 5 Jul 2025 16:46:51 +0800 Subject: [PATCH 1/5] feat: support config the scss variables --- README.md | 21 ++++++++ package.json | 1 + playground/app.vue | 2 +- playground/nuxt.config.ts | 23 +++++++- pnpm-lock.yaml | 108 +++++++++++++++++++++++--------------- src/core/index.ts | 1 + src/core/options.ts | 32 ++++++++++- src/core/themeChalk.ts | 80 ++++++++++++++++++++++++++++ src/module.ts | 2 + src/types.ts | 35 +++++++++++- src/utils.ts | 4 ++ 11 files changed, 261 insertions(+), 48 deletions(-) create mode 100644 src/core/themeChalk.ts diff --git a/README.md b/README.md index 1bf1537..1153fd4 100644 --- a/README.md +++ b/README.md @@ -121,6 +121,27 @@ Whether to cache the element-plus components and directives. **Only effective in If you enable this feature, you will get faster loading speed in development mode. +### themeChalk + +- Type: `object` + +Configure SCSS variables for generating custom themes. **Only effective when `importStyle` is `scss`**. + +e.g. + +```ts +{ + $colors: { + primary: { base: 'rgba(107,33,168, 1)' } + }, + dark: { + $colors: { + primary: { base: 'rgb(242, 216, 22)' } + } + } +} +``` + ### globalConfig - Type: `object` diff --git a/package.json b/package.json index 5e70f00..ce68692 100644 --- a/package.json +++ b/package.json @@ -56,6 +56,7 @@ "eslint": "^8.57.1", "nuxi": "^3.15.0", "nuxt": "^3.13.2", + "sass": "^1.89.2", "typescript": "^5.6.3", "vue": "^3.5.12" } diff --git a/playground/app.vue b/playground/app.vue index 3ab6a08..1be2f20 100644 --- a/playground/app.vue +++ b/playground/app.vue @@ -43,7 +43,7 @@ function changeTheme () {