@zeldafox/vue-tailwind-theme-kit 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +237 -0
- package/dist/composables/useTheme.d.ts +12 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.es.js +421 -0
- package/dist/index.umd.js +1 -0
- package/dist/themes/index.d.ts +3 -0
- package/dist/types/index.d.ts +11 -0
- package/package.json +35 -0
- package/preset.cjs +70 -0
package/README.md
ADDED
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
# @zeldafox/vue-tailwind-theme-kit
|
|
2
|
+
|
|
3
|
+
一个为 Vue 3 和 TailwindCSS 量身定制的**动态主题库**。支持动态切换主题色、暗色模式、系统偏好感应、SSR (服务端渲染) 安全隔离,并支持用户自定义扩展主题。
|
|
4
|
+
|
|
5
|
+
## 特性
|
|
6
|
+
|
|
7
|
+
* 🎨 **动态全套主题切换**:内置包含 `theme`(默认样式)、`claude`、`twitter` 和 `vercel` 四套精美预设。
|
|
8
|
+
* 🌓 **全属性映射**:通过 Tailwind CSS 预设自动扩展 `colors`(如 `background`、`foreground`、`primary`、`secondary`、`card`、`sidebar`、`muted` 等)、`borderRadius`、`fontFamily` 变量。
|
|
9
|
+
* 🌓 **暗色模式切换**:支持手动切换、显式设置以及自动跟随系统偏好(`prefers-color-scheme`)。
|
|
10
|
+
* ⚡ **SSR 安全设计**:使用 Vue `provide` / `inject` 进行应用级状态隔离,完全规避多请求下的跨请求状态污染,对 Nuxt 3 友好。
|
|
11
|
+
* 📦 **现代打包格式**:支持导出 ESM 与 UMD 两种模块格式,附带完整的 TypeScript 类型声明支持。
|
|
12
|
+
* ✨ **防闪烁支持**:提供客户端/服务端首屏加载时防颜色闪烁 (Anti-FOUC) 最佳实践。
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## 安装
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npm install @zeldafox/vue-tailwind-theme-kit
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## 快速上手
|
|
25
|
+
|
|
26
|
+
### 1. 引入 Tailwind CSS 预设
|
|
27
|
+
|
|
28
|
+
在项目的 `tailwind.config.js`(或 `tailwind.config.mjs`)中引入库预设:
|
|
29
|
+
|
|
30
|
+
```javascript
|
|
31
|
+
import themePreset from "@zeldafox/vue-tailwind-theme-kit/preset";
|
|
32
|
+
|
|
33
|
+
export default {
|
|
34
|
+
presets: [themePreset],
|
|
35
|
+
content: [
|
|
36
|
+
"./index.html",
|
|
37
|
+
"./src/**/*.{vue,js,ts,jsx,tsx}",
|
|
38
|
+
],
|
|
39
|
+
};
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### 2. 注册 Vue 插件
|
|
43
|
+
|
|
44
|
+
在项目入口文件(例如 `main.ts` 或 `main.js`)中注册:
|
|
45
|
+
|
|
46
|
+
```typescript
|
|
47
|
+
import { createApp } from 'vue';
|
|
48
|
+
import App from './App.vue';
|
|
49
|
+
import { themePlugin } from '@zeldafox/vue-tailwind-theme-kit';
|
|
50
|
+
|
|
51
|
+
// 引入基础 Tailwind 样式
|
|
52
|
+
import './assets/main.css';
|
|
53
|
+
|
|
54
|
+
const app = createApp(App);
|
|
55
|
+
|
|
56
|
+
app.use(themePlugin, {
|
|
57
|
+
defaultTheme: 'theme', // 默认内置主题,可选 'theme' | 'claude' | 'twitter' | 'vercel'
|
|
58
|
+
// defaultDark: false, // 是否默认启用暗色模式。若不填则自动感应系统深浅色偏好
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
app.mount('#app');
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### 3. 在业务组件中使用
|
|
65
|
+
|
|
66
|
+
在 Vue 组件中通过 `useTheme()` 轻松控制和感应主题状态:
|
|
67
|
+
|
|
68
|
+
```html
|
|
69
|
+
<template>
|
|
70
|
+
<div class="min-h-screen bg-background text-foreground transition-colors duration-200 font-sans">
|
|
71
|
+
<div class="max-w-2xl mx-auto p-8 space-y-6">
|
|
72
|
+
<div class="p-6 bg-card text-card-foreground rounded-lg border border-border shadow-md">
|
|
73
|
+
<h2 class="text-2xl font-bold text-primary mb-2">动态主题展示</h2>
|
|
74
|
+
<p class="text-muted-foreground">当前主题名称: <strong class="text-foreground">{{ theme }}</strong></p>
|
|
75
|
+
<p class="text-muted-foreground">当前模式: <strong class="text-foreground">{{ isDark ? '深色 🌙' : '浅色 ☀️' }}</strong></p>
|
|
76
|
+
</div>
|
|
77
|
+
|
|
78
|
+
<div class="flex flex-wrap gap-4">
|
|
79
|
+
<button
|
|
80
|
+
@click="setTheme('theme')"
|
|
81
|
+
class="px-4 py-2 bg-primary text-primary-foreground hover:opacity-90 rounded-md shadow transition"
|
|
82
|
+
>
|
|
83
|
+
默认主题 (theme)
|
|
84
|
+
</button>
|
|
85
|
+
<button
|
|
86
|
+
@click="setTheme('claude')"
|
|
87
|
+
class="px-4 py-2 bg-primary text-primary-foreground hover:opacity-90 rounded-md shadow transition"
|
|
88
|
+
>
|
|
89
|
+
Claude 主题
|
|
90
|
+
</button>
|
|
91
|
+
<button
|
|
92
|
+
@click="setTheme('twitter')"
|
|
93
|
+
class="px-4 py-2 bg-primary text-primary-foreground hover:opacity-90 rounded-md shadow transition"
|
|
94
|
+
>
|
|
95
|
+
Twitter 主题
|
|
96
|
+
</button>
|
|
97
|
+
<button
|
|
98
|
+
@click="setTheme('vercel')"
|
|
99
|
+
class="px-4 py-2 bg-primary text-primary-foreground hover:opacity-90 rounded-md shadow transition"
|
|
100
|
+
>
|
|
101
|
+
Vercel 主题
|
|
102
|
+
</button>
|
|
103
|
+
<button
|
|
104
|
+
@click="toggleDarkMode"
|
|
105
|
+
class="px-4 py-2 border border-border text-foreground rounded-md hover:bg-muted transition"
|
|
106
|
+
>
|
|
107
|
+
切换暗色模式
|
|
108
|
+
</button>
|
|
109
|
+
<button
|
|
110
|
+
@click="setDarkMode(true)"
|
|
111
|
+
class="px-4 py-2 bg-primary text-primary-foreground rounded-md hover:opacity-90 transition"
|
|
112
|
+
>
|
|
113
|
+
强行启用暗色
|
|
114
|
+
</button>
|
|
115
|
+
</div>
|
|
116
|
+
</div>
|
|
117
|
+
</div>
|
|
118
|
+
</template>
|
|
119
|
+
|
|
120
|
+
<script setup lang="ts">
|
|
121
|
+
import { useTheme } from '@zeldafox/vue-tailwind-theme-kit';
|
|
122
|
+
|
|
123
|
+
const { theme, isDark, setTheme, setDarkMode, toggleDarkMode } = useTheme();
|
|
124
|
+
</script>
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
## 进阶配置与自定义主题
|
|
130
|
+
|
|
131
|
+
你可以在插件初始化时,通过 `extraThemes` 选项传入自定义的主题配置(颜色格式推荐与 CSS 规范相符,例如 `oklch(...)`、`hsl(...)` 或 `rgb(...)`,它们可直接适配预设配置下的透明度感知):
|
|
132
|
+
|
|
133
|
+
```typescript
|
|
134
|
+
import { themePlugin } from '@zeldafox/vue-tailwind-theme-kit';
|
|
135
|
+
|
|
136
|
+
app.use(themePlugin, {
|
|
137
|
+
defaultTheme: 'sunset',
|
|
138
|
+
extraThemes: {
|
|
139
|
+
sunset: {
|
|
140
|
+
name: 'sunset',
|
|
141
|
+
light: {
|
|
142
|
+
background: 'oklch(0.98 0.02 80)',
|
|
143
|
+
foreground: 'oklch(0.15 0.05 40)',
|
|
144
|
+
card: 'oklch(1 0 0)',
|
|
145
|
+
'card-foreground': 'oklch(0.15 0.05 40)',
|
|
146
|
+
popover: 'oklch(1 0 0)',
|
|
147
|
+
'popover-foreground': 'oklch(0.15 0.05 40)',
|
|
148
|
+
primary: 'oklch(0.65 0.22 45)', // 亮橘色
|
|
149
|
+
'primary-foreground': 'oklch(0.99 0.01 90)',
|
|
150
|
+
secondary: 'oklch(0.95 0.02 80)',
|
|
151
|
+
'secondary-foreground': 'oklch(0.15 0.05 40)',
|
|
152
|
+
muted: 'oklch(0.95 0.02 80)',
|
|
153
|
+
'muted-foreground': 'oklch(0.45 0.05 40)',
|
|
154
|
+
accent: 'oklch(0.95 0.02 80)',
|
|
155
|
+
'accent-foreground': 'oklch(0.15 0.05 40)',
|
|
156
|
+
destructive: 'oklch(0.57 0.23 27)',
|
|
157
|
+
'destructive-foreground': 'oklch(1 0 0)',
|
|
158
|
+
border: 'oklch(0.92 0.02 80)',
|
|
159
|
+
input: 'oklch(0.92 0.02 80)',
|
|
160
|
+
ring: 'oklch(0.65 0.22 45)',
|
|
161
|
+
radius: '0.5rem',
|
|
162
|
+
'font-sans': 'sans-serif'
|
|
163
|
+
},
|
|
164
|
+
dark: {
|
|
165
|
+
background: 'oklch(0.15 0.05 40)',
|
|
166
|
+
foreground: 'oklch(0.98 0.02 80)',
|
|
167
|
+
card: 'oklch(0.18 0.04 40)',
|
|
168
|
+
'card-foreground': 'oklch(0.98 0.02 80)',
|
|
169
|
+
popover: 'oklch(0.18 0.04 40)',
|
|
170
|
+
'popover-foreground': 'oklch(0.98 0.02 80)',
|
|
171
|
+
primary: 'oklch(0.70 0.20 45)',
|
|
172
|
+
'primary-foreground': 'oklch(0.15 0.05 40)',
|
|
173
|
+
secondary: 'oklch(0.22 0.04 40)',
|
|
174
|
+
'secondary-foreground': 'oklch(0.98 0.02 80)',
|
|
175
|
+
muted: 'oklch(0.22 0.04 40)',
|
|
176
|
+
'muted-foreground': 'oklch(0.75 0.02 80)',
|
|
177
|
+
accent: 'oklch(0.22 0.04 40)',
|
|
178
|
+
'accent-foreground': 'oklch(0.98 0.02 80)',
|
|
179
|
+
destructive: 'oklch(0.57 0.23 27)',
|
|
180
|
+
'destructive-foreground': 'oklch(1 0 0)',
|
|
181
|
+
border: 'oklch(0.25 0.04 40)',
|
|
182
|
+
input: 'oklch(0.25 0.04 40)',
|
|
183
|
+
ring: 'oklch(0.70 0.20 45)',
|
|
184
|
+
radius: '0.5rem',
|
|
185
|
+
'font-sans': 'sans-serif'
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
---
|
|
193
|
+
|
|
194
|
+
## 最佳实践:防止首屏闪烁 (Anti-FOUC)
|
|
195
|
+
|
|
196
|
+
由于 CSS 变量的挂载和暗色类名触发依赖于 JavaScript 执行,在首屏加载时,页面可能会短暂地显露浅色背景。
|
|
197
|
+
|
|
198
|
+
为了保证极致的视觉体验,建议在项目的 `index.html` 模板 `<head>` 中植入以下极简内联脚本。这段脚本优先执行且不依赖任何框架包,可以实现无缝的暗色模式首屏加载:
|
|
199
|
+
|
|
200
|
+
```html
|
|
201
|
+
<script>
|
|
202
|
+
(function() {
|
|
203
|
+
try {
|
|
204
|
+
const savedTheme = localStorage.getItem('ui-theme') || 'theme';
|
|
205
|
+
const savedDark = localStorage.getItem('ui-dark-mode');
|
|
206
|
+
const isDark = savedDark !== null ? savedDark === 'true' : window.matchMedia('(prefers-color-scheme: dark)').matches;
|
|
207
|
+
|
|
208
|
+
// 提前注入 dark 类名防闪烁
|
|
209
|
+
if (isDark) {
|
|
210
|
+
document.documentElement.classList.add('dark');
|
|
211
|
+
} else {
|
|
212
|
+
document.documentElement.classList.remove('dark');
|
|
213
|
+
}
|
|
214
|
+
} catch (e) {}
|
|
215
|
+
})();
|
|
216
|
+
</script>
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
---
|
|
220
|
+
|
|
221
|
+
## 开发与构建
|
|
222
|
+
|
|
223
|
+
1. 安装依赖:
|
|
224
|
+
```bash
|
|
225
|
+
npm install
|
|
226
|
+
```
|
|
227
|
+
2. 执行编译:
|
|
228
|
+
```bash
|
|
229
|
+
npm run build
|
|
230
|
+
```
|
|
231
|
+
该指令将使用 Vite 打包并将包编译生成到 `dist/` 文件夹下,包含 `index.es.js`, `index.umd.js` 以及 TypeScript 定义文件 `index.d.ts`。
|
|
232
|
+
|
|
233
|
+
---
|
|
234
|
+
|
|
235
|
+
## 授权许可
|
|
236
|
+
|
|
237
|
+
[MIT License](LICENSE)
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { InjectionKey, Ref } from 'vue';
|
|
2
|
+
|
|
3
|
+
export interface ThemeState {
|
|
4
|
+
theme: Ref<string>;
|
|
5
|
+
isDark: Ref<boolean>;
|
|
6
|
+
setTheme: (themeName: string) => void;
|
|
7
|
+
setDarkMode: (value: boolean) => void;
|
|
8
|
+
toggleDarkMode: () => void;
|
|
9
|
+
}
|
|
10
|
+
export declare const ThemeSymbol: InjectionKey<ThemeState>;
|
|
11
|
+
export declare function createThemeState(defaultThemeName?: string, defaultDark?: boolean): ThemeState;
|
|
12
|
+
export declare function useTheme(): ThemeState;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { App } from 'vue';
|
|
2
|
+
import { PluginOptions } from './types';
|
|
3
|
+
|
|
4
|
+
export declare const themePlugin: {
|
|
5
|
+
install(app: App, options?: PluginOptions): void;
|
|
6
|
+
};
|
|
7
|
+
export { useTheme } from './composables/useTheme';
|
|
8
|
+
export type { ThemeConfig, ThemeColors, PluginOptions } from './types';
|
package/dist/index.es.js
ADDED
|
@@ -0,0 +1,421 @@
|
|
|
1
|
+
import { inject as b, ref as n } from "vue";
|
|
2
|
+
const s = {
|
|
3
|
+
theme: {
|
|
4
|
+
name: "theme",
|
|
5
|
+
light: {
|
|
6
|
+
background: "oklch(1 0 0)",
|
|
7
|
+
foreground: "oklch(0.145 0 0)",
|
|
8
|
+
card: "oklch(1 0 0)",
|
|
9
|
+
"card-foreground": "oklch(0.145 0 0)",
|
|
10
|
+
popover: "oklch(1 0 0)",
|
|
11
|
+
"popover-foreground": "oklch(0.145 0 0)",
|
|
12
|
+
primary: "oklch(0.205 0 0)",
|
|
13
|
+
"primary-foreground": "oklch(0.985 0 0)",
|
|
14
|
+
secondary: "oklch(0.97 0 0)",
|
|
15
|
+
"secondary-foreground": "oklch(0.205 0 0)",
|
|
16
|
+
muted: "oklch(0.97 0 0)",
|
|
17
|
+
"muted-foreground": "oklch(0.556 0 0)",
|
|
18
|
+
accent: "oklch(0.97 0 0)",
|
|
19
|
+
"accent-foreground": "oklch(0.205 0 0)",
|
|
20
|
+
destructive: "oklch(0.577 0.245 27.325)",
|
|
21
|
+
"destructive-foreground": "oklch(1 0 0)",
|
|
22
|
+
border: "oklch(0.922 0 0)",
|
|
23
|
+
input: "oklch(0.922 0 0)",
|
|
24
|
+
ring: "oklch(0.708 0 0)",
|
|
25
|
+
"chart-1": "oklch(0.81 0.10 252)",
|
|
26
|
+
"chart-2": "oklch(0.62 0.19 260)",
|
|
27
|
+
"chart-3": "oklch(0.55 0.22 263)",
|
|
28
|
+
"chart-4": "oklch(0.49 0.22 264)",
|
|
29
|
+
"chart-5": "oklch(0.42 0.18 266)",
|
|
30
|
+
radius: "0.625rem",
|
|
31
|
+
spacing: "0.25rem",
|
|
32
|
+
"letter-spacing": "0em",
|
|
33
|
+
"shadow-color": "oklch(0 0 0)",
|
|
34
|
+
"shadow-opacity": "0.1",
|
|
35
|
+
"shadow-blur": "3px",
|
|
36
|
+
"shadow-spread": "0px",
|
|
37
|
+
"shadow-offset-x": "0",
|
|
38
|
+
"shadow-offset-y": "1px",
|
|
39
|
+
"font-sans": "ui-sans-serif, system-ui, sans-serif",
|
|
40
|
+
"font-serif": "ui-serif, Georgia, serif",
|
|
41
|
+
"font-mono": "ui-monospace, SFMono-Regular, monospace"
|
|
42
|
+
},
|
|
43
|
+
dark: {
|
|
44
|
+
background: "oklch(0.145 0 0)",
|
|
45
|
+
foreground: "oklch(0.985 0 0)",
|
|
46
|
+
card: "oklch(0.205 0 0)",
|
|
47
|
+
"card-foreground": "oklch(0.985 0 0)",
|
|
48
|
+
popover: "oklch(0.205 0 0)",
|
|
49
|
+
"popover-foreground": "oklch(0.985 0 0)",
|
|
50
|
+
primary: "oklch(0.922 0 0)",
|
|
51
|
+
"primary-foreground": "oklch(0.205 0 0)",
|
|
52
|
+
secondary: "oklch(0.269 0 0)",
|
|
53
|
+
"secondary-foreground": "oklch(0.985 0 0)",
|
|
54
|
+
muted: "oklch(0.269 0 0)",
|
|
55
|
+
"muted-foreground": "oklch(0.708 0 0)",
|
|
56
|
+
accent: "oklch(0.269 0 0)",
|
|
57
|
+
"accent-foreground": "oklch(0.985 0 0)",
|
|
58
|
+
destructive: "oklch(0.577 0.245 27.325)",
|
|
59
|
+
"destructive-foreground": "oklch(1 0 0)",
|
|
60
|
+
border: "oklch(0.269 0 0)",
|
|
61
|
+
input: "oklch(0.269 0 0)",
|
|
62
|
+
ring: "oklch(0.556 0 0)",
|
|
63
|
+
"chart-1": "oklch(0.81 0.10 252)",
|
|
64
|
+
"chart-2": "oklch(0.62 0.19 260)",
|
|
65
|
+
"chart-3": "oklch(0.55 0.22 263)",
|
|
66
|
+
"chart-4": "oklch(0.49 0.22 264)",
|
|
67
|
+
"chart-5": "oklch(0.42 0.18 266)",
|
|
68
|
+
radius: "0.625rem",
|
|
69
|
+
spacing: "0.25rem",
|
|
70
|
+
"letter-spacing": "0em",
|
|
71
|
+
"shadow-color": "oklch(0 0 0)",
|
|
72
|
+
"shadow-opacity": "0.2",
|
|
73
|
+
"shadow-blur": "4px",
|
|
74
|
+
"shadow-spread": "0px",
|
|
75
|
+
"shadow-offset-x": "0",
|
|
76
|
+
"shadow-offset-y": "2px",
|
|
77
|
+
"font-sans": "ui-sans-serif, system-ui, sans-serif",
|
|
78
|
+
"font-serif": "ui-serif, Georgia, serif",
|
|
79
|
+
"font-mono": "ui-monospace, SFMono-Regular, monospace"
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
claude: {
|
|
83
|
+
name: "claude",
|
|
84
|
+
light: {
|
|
85
|
+
ring: "oklch(0.6171 0.1375 39.0427)",
|
|
86
|
+
"chart-4": "oklch(0.8822 0.0403 298.1792)",
|
|
87
|
+
"chart-3": "oklch(0.8816 0.0276 93.1280)",
|
|
88
|
+
"secondary-foreground": "oklch(0.4334 0.0177 98.6048)",
|
|
89
|
+
"chart-5": "oklch(0.5608 0.1348 42.0584)",
|
|
90
|
+
foreground: "oklch(0.3438 0.0269 95.7226)",
|
|
91
|
+
"shadow-spread": "0px",
|
|
92
|
+
"chart-2": "oklch(0.6898 0.1581 290.4107)",
|
|
93
|
+
"accent-foreground": "oklch(0.2671 0.0196 98.9390)",
|
|
94
|
+
"chart-1": "oklch(0.5583 0.1276 42.9956)",
|
|
95
|
+
"muted-foreground": "oklch(0.6059 0.0075 97.4233)",
|
|
96
|
+
"font-mono": 'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',
|
|
97
|
+
spacing: "0.25rem",
|
|
98
|
+
sidebar: "oklch(0.9663 0.0080 98.8792)",
|
|
99
|
+
"popover-foreground": "oklch(0.2671 0.0196 98.9390)",
|
|
100
|
+
radius: "0.5rem",
|
|
101
|
+
muted: "oklch(0.9341 0.0153 90.2390)",
|
|
102
|
+
border: "oklch(0.8847 0.0069 97.3627)",
|
|
103
|
+
"primary-foreground": "oklch(1.0000 0 0)",
|
|
104
|
+
popover: "oklch(1.0000 0 0)",
|
|
105
|
+
"font-sans": "ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'",
|
|
106
|
+
"letter-spacing": "0em",
|
|
107
|
+
"shadow-color": "oklch(0 0 0)",
|
|
108
|
+
"shadow-opacity": "0.1",
|
|
109
|
+
"sidebar-border": "oklch(0.9401 0 0)",
|
|
110
|
+
"sidebar-primary": "oklch(0.6171 0.1375 39.0427)",
|
|
111
|
+
"sidebar-primary-foreground": "oklch(0.9881 0 0)",
|
|
112
|
+
accent: "oklch(0.9245 0.0138 92.9892)",
|
|
113
|
+
"font-serif": 'ui-serif, Georgia, Cambria, "Times New Roman", Times, serif',
|
|
114
|
+
destructive: "oklch(0.1908 0.0020 106.5859)",
|
|
115
|
+
secondary: "oklch(0.9245 0.0138 92.9892)",
|
|
116
|
+
"sidebar-foreground": "oklch(0.3590 0.0051 106.6524)",
|
|
117
|
+
"sidebar-accent-foreground": "oklch(0.3250 0 0)",
|
|
118
|
+
input: "oklch(0.7621 0.0156 98.3528)",
|
|
119
|
+
"shadow-offset-x": "0",
|
|
120
|
+
"sidebar-ring": "oklch(0.7731 0 0)",
|
|
121
|
+
"sidebar-accent": "oklch(0.9245 0.0138 92.9892)",
|
|
122
|
+
"destructive-foreground": "oklch(1.0000 0 0)",
|
|
123
|
+
"shadow-offset-y": "1px",
|
|
124
|
+
background: "oklch(0.9818 0.0054 95.0986)",
|
|
125
|
+
"shadow-blur": "3px",
|
|
126
|
+
"card-foreground": "oklch(0.1908 0.0020 106.5859)",
|
|
127
|
+
card: "oklch(0.9818 0.0054 95.0986)",
|
|
128
|
+
primary: "oklch(0.6171 0.1375 39.0427)"
|
|
129
|
+
},
|
|
130
|
+
dark: {
|
|
131
|
+
ring: "oklch(0.6724 0.1308 38.7559)",
|
|
132
|
+
"chart-4": "oklch(0.3074 0.0516 289.3230)",
|
|
133
|
+
"chart-3": "oklch(0.2130 0.0078 95.4245)",
|
|
134
|
+
"secondary-foreground": "oklch(0.3085 0.0035 106.6039)",
|
|
135
|
+
"chart-5": "oklch(0.5608 0.1348 42.0584)",
|
|
136
|
+
foreground: "oklch(0.8074 0.0142 93.0137)",
|
|
137
|
+
"shadow-spread": "0px",
|
|
138
|
+
"chart-2": "oklch(0.6898 0.1581 290.4107)",
|
|
139
|
+
"accent-foreground": "oklch(0.9663 0.0080 98.8792)",
|
|
140
|
+
"chart-1": "oklch(0.5583 0.1276 42.9956)",
|
|
141
|
+
"muted-foreground": "oklch(0.7713 0.0169 99.0657)",
|
|
142
|
+
"font-mono": 'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',
|
|
143
|
+
sidebar: "oklch(0.2357 0.0024 67.7077)",
|
|
144
|
+
"popover-foreground": "oklch(0.9211 0.0040 106.4781)",
|
|
145
|
+
radius: "0.625rem",
|
|
146
|
+
muted: "oklch(0.2213 0.0038 106.7070)",
|
|
147
|
+
border: "oklch(0.3618 0.0101 106.8928)",
|
|
148
|
+
"primary-foreground": "oklch(1.0000 0 0)",
|
|
149
|
+
popover: "oklch(0.3085 0.0035 106.6039)",
|
|
150
|
+
"font-sans": "ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'",
|
|
151
|
+
"shadow-color": "oklch(0 0 0)",
|
|
152
|
+
"shadow-opacity": "0.1",
|
|
153
|
+
"sidebar-border": "oklch(0.9401 0 0)",
|
|
154
|
+
"sidebar-primary": "oklch(0.3250 0 0)",
|
|
155
|
+
"sidebar-primary-foreground": "oklch(0.9881 0 0)",
|
|
156
|
+
accent: "oklch(0.2130 0.0078 95.4245)",
|
|
157
|
+
"font-serif": 'ui-serif, Georgia, Cambria, "Times New Roman", Times, serif',
|
|
158
|
+
destructive: "oklch(0.6368 0.2078 25.3313)",
|
|
159
|
+
secondary: "oklch(0.9818 0.0054 95.0986)",
|
|
160
|
+
"sidebar-foreground": "oklch(0.8074 0.0142 93.0137)",
|
|
161
|
+
"sidebar-accent-foreground": "oklch(0.8074 0.0142 93.0137)",
|
|
162
|
+
input: "oklch(0.4336 0.0113 100.2195)",
|
|
163
|
+
"shadow-offset-x": "0",
|
|
164
|
+
"sidebar-ring": "oklch(0.7731 0 0)",
|
|
165
|
+
"sidebar-accent": "oklch(0.1680 0.0020 106.6177)",
|
|
166
|
+
"destructive-foreground": "oklch(1.0000 0 0)",
|
|
167
|
+
"shadow-offset-y": "1px",
|
|
168
|
+
background: "oklch(0.2679 0.0036 106.6427)",
|
|
169
|
+
"shadow-blur": "3px",
|
|
170
|
+
"card-foreground": "oklch(0.9818 0.0054 95.0986)",
|
|
171
|
+
card: "oklch(0.2679 0.0036 106.6427)",
|
|
172
|
+
primary: "oklch(0.6724 0.1308 38.7559)"
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
twitter: {
|
|
176
|
+
name: "twitter",
|
|
177
|
+
light: {
|
|
178
|
+
ring: "oklch(0.6818 0.1584 243.3540)",
|
|
179
|
+
"chart-4": "oklch(0.7064 0.1822 151.7125)",
|
|
180
|
+
"chart-3": "oklch(0.8214 0.1600 82.5337)",
|
|
181
|
+
"secondary-foreground": "oklch(1.0000 0 0)",
|
|
182
|
+
"chart-5": "oklch(0.5919 0.2186 10.5826)",
|
|
183
|
+
foreground: "oklch(0.1884 0.0128 248.5103)",
|
|
184
|
+
"shadow-spread": "0px",
|
|
185
|
+
"chart-2": "oklch(0.6907 0.1554 160.3454)",
|
|
186
|
+
"accent-foreground": "oklch(0.6723 0.1606 244.9955)",
|
|
187
|
+
"chart-1": "oklch(0.6723 0.1606 244.9955)",
|
|
188
|
+
"muted-foreground": "oklch(0.1884 0.0128 248.5103)",
|
|
189
|
+
"font-mono": "Menlo, monospace",
|
|
190
|
+
spacing: "0.25rem",
|
|
191
|
+
sidebar: "oklch(0.9784 0.0011 197.1387)",
|
|
192
|
+
"popover-foreground": "oklch(0.1884 0.0128 248.5103)",
|
|
193
|
+
radius: "1.3rem",
|
|
194
|
+
muted: "oklch(0.9222 0.0013 286.3737)",
|
|
195
|
+
border: "oklch(0.9317 0.0118 231.6594)",
|
|
196
|
+
"primary-foreground": "oklch(1.0000 0 0)",
|
|
197
|
+
popover: "oklch(1.0000 0 0)",
|
|
198
|
+
"font-sans": "Open Sans, sans-serif",
|
|
199
|
+
"letter-spacing": "0em",
|
|
200
|
+
"shadow-color": "rgba(29,161,242,0.15)",
|
|
201
|
+
"shadow-opacity": "0",
|
|
202
|
+
"sidebar-border": "oklch(0.9271 0.0101 238.5177)",
|
|
203
|
+
"sidebar-primary": "oklch(0.6723 0.1606 244.9955)",
|
|
204
|
+
"sidebar-primary-foreground": "oklch(1.0000 0 0)",
|
|
205
|
+
accent: "oklch(0.9392 0.0166 250.8453)",
|
|
206
|
+
"font-serif": "Georgia, serif",
|
|
207
|
+
destructive: "oklch(0.6188 0.2376 25.7658)",
|
|
208
|
+
secondary: "oklch(0.1884 0.0128 248.5103)",
|
|
209
|
+
"sidebar-foreground": "oklch(0.1884 0.0128 248.5103)",
|
|
210
|
+
"sidebar-accent-foreground": "oklch(0.6723 0.1606 244.9955)",
|
|
211
|
+
input: "oklch(0.9809 0.0025 228.7836)",
|
|
212
|
+
"shadow-offset-x": "0px",
|
|
213
|
+
"sidebar-ring": "oklch(0.6818 0.1584 243.3540)",
|
|
214
|
+
"sidebar-accent": "oklch(0.9392 0.0166 250.8453)",
|
|
215
|
+
"destructive-foreground": "oklch(1.0000 0 0)",
|
|
216
|
+
"shadow-offset-y": "2px",
|
|
217
|
+
background: "oklch(1.0000 0 0)",
|
|
218
|
+
"shadow-blur": "0px",
|
|
219
|
+
"card-foreground": "oklch(0.1884 0.0128 248.5103)",
|
|
220
|
+
card: "oklch(0.9784 0.0011 197.1387)",
|
|
221
|
+
primary: "oklch(0.6723 0.1606 244.9955)"
|
|
222
|
+
},
|
|
223
|
+
dark: {
|
|
224
|
+
ring: "oklch(0.6818 0.1584 243.3540)",
|
|
225
|
+
"chart-4": "oklch(0.7064 0.1822 151.7125)",
|
|
226
|
+
"chart-3": "oklch(0.8214 0.1600 82.5337)",
|
|
227
|
+
"secondary-foreground": "oklch(0.1884 0.0128 248.5103)",
|
|
228
|
+
"chart-5": "oklch(0.5919 0.2186 10.5826)",
|
|
229
|
+
foreground: "oklch(0.9328 0.0025 228.7857)",
|
|
230
|
+
"shadow-spread": "0px",
|
|
231
|
+
"chart-2": "oklch(0.6907 0.1554 160.3454)",
|
|
232
|
+
"accent-foreground": "oklch(0.6692 0.1607 245.0110)",
|
|
233
|
+
"chart-1": "oklch(0.6723 0.1606 244.9955)",
|
|
234
|
+
"muted-foreground": "oklch(0.5637 0.0078 247.9662)",
|
|
235
|
+
"font-mono": 'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',
|
|
236
|
+
sidebar: "oklch(0.2097 0.0080 274.5332)",
|
|
237
|
+
"popover-foreground": "oklch(0.9328 0.0025 228.7857)",
|
|
238
|
+
radius: "0.625rem",
|
|
239
|
+
muted: "oklch(0.2090 0 0)",
|
|
240
|
+
border: "oklch(0.2674 0.0047 248.0045)",
|
|
241
|
+
"primary-foreground": "oklch(1.0000 0 0)",
|
|
242
|
+
popover: "oklch(0 0 0)",
|
|
243
|
+
"font-sans": "ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'",
|
|
244
|
+
"shadow-color": "rgba(29,161,242,0.25)",
|
|
245
|
+
"shadow-opacity": "0.1",
|
|
246
|
+
"sidebar-border": "oklch(0.3795 0.0220 240.5943)",
|
|
247
|
+
"sidebar-primary": "oklch(0.6818 0.1584 243.3540)",
|
|
248
|
+
"sidebar-primary-foreground": "oklch(1.0000 0 0)",
|
|
249
|
+
accent: "oklch(0.1928 0.0331 242.5459)",
|
|
250
|
+
"font-serif": 'ui-serif, Georgia, Cambria, "Times New Roman", Times, serif',
|
|
251
|
+
destructive: "oklch(0.6188 0.2376 25.7658)",
|
|
252
|
+
secondary: "oklch(0.9622 0.0035 219.5331)",
|
|
253
|
+
"sidebar-foreground": "oklch(0.8853 0 0)",
|
|
254
|
+
"sidebar-accent-foreground": "oklch(0.6692 0.1607 245.0110)",
|
|
255
|
+
input: "oklch(0.3020 0.0288 244.8244)",
|
|
256
|
+
"shadow-offset-x": "0",
|
|
257
|
+
"sidebar-ring": "oklch(0.6818 0.1584 243.3540)",
|
|
258
|
+
"sidebar-accent": "oklch(0.1928 0.0331 242.5459)",
|
|
259
|
+
"destructive-foreground": "oklch(1.0000 0 0)",
|
|
260
|
+
"shadow-offset-y": "1px",
|
|
261
|
+
background: "oklch(0 0 0)",
|
|
262
|
+
"shadow-blur": "3px",
|
|
263
|
+
"card-foreground": "oklch(0.8853 0 0)",
|
|
264
|
+
card: "oklch(0.2097 0.0080 274.5332)",
|
|
265
|
+
primary: "oklch(0.6692 0.1607 245.0110)"
|
|
266
|
+
}
|
|
267
|
+
},
|
|
268
|
+
vercel: {
|
|
269
|
+
name: "vercel",
|
|
270
|
+
light: {
|
|
271
|
+
ring: "oklch(0 0 0)",
|
|
272
|
+
"chart-4": "oklch(0.9200 0 0)",
|
|
273
|
+
"chart-3": "oklch(0.7200 0 0)",
|
|
274
|
+
"secondary-foreground": "oklch(0 0 0)",
|
|
275
|
+
"chart-5": "oklch(0.5600 0 0)",
|
|
276
|
+
foreground: "oklch(0 0 0)",
|
|
277
|
+
"shadow-spread": "0px",
|
|
278
|
+
"chart-2": "oklch(0.5500 0.2200 264.5300)",
|
|
279
|
+
"accent-foreground": "oklch(0 0 0)",
|
|
280
|
+
"chart-1": "oklch(0.8100 0.1700 75.3500)",
|
|
281
|
+
"muted-foreground": "oklch(0.4400 0 0)",
|
|
282
|
+
"font-mono": "Geist Mono, monospace",
|
|
283
|
+
spacing: "0.25rem",
|
|
284
|
+
sidebar: "oklch(0.9900 0 0)",
|
|
285
|
+
"popover-foreground": "oklch(0 0 0)",
|
|
286
|
+
radius: "0.5rem",
|
|
287
|
+
muted: "oklch(0.9700 0 0)",
|
|
288
|
+
border: "oklch(0.9200 0 0)",
|
|
289
|
+
"primary-foreground": "oklch(1 0 0)",
|
|
290
|
+
popover: "oklch(0.9900 0 0)",
|
|
291
|
+
"font-sans": "Geist, sans-serif",
|
|
292
|
+
"letter-spacing": "0em",
|
|
293
|
+
"shadow-color": "hsl(0 0% 0%)",
|
|
294
|
+
"shadow-opacity": "0.18",
|
|
295
|
+
"sidebar-border": "oklch(0.9400 0 0)",
|
|
296
|
+
"sidebar-primary": "oklch(0 0 0)",
|
|
297
|
+
"sidebar-primary-foreground": "oklch(1 0 0)",
|
|
298
|
+
accent: "oklch(0.9400 0 0)",
|
|
299
|
+
"font-serif": "Georgia, serif",
|
|
300
|
+
destructive: "oklch(0.6300 0.1900 23.0300)",
|
|
301
|
+
secondary: "oklch(0.9400 0 0)",
|
|
302
|
+
"sidebar-foreground": "oklch(0 0 0)",
|
|
303
|
+
"sidebar-accent-foreground": "oklch(0 0 0)",
|
|
304
|
+
input: "oklch(0.9400 0 0)",
|
|
305
|
+
"shadow-offset-x": "0px",
|
|
306
|
+
"sidebar-ring": "oklch(0 0 0)",
|
|
307
|
+
"sidebar-accent": "oklch(0.9400 0 0)",
|
|
308
|
+
"destructive-foreground": "oklch(1 0 0)",
|
|
309
|
+
"shadow-offset-y": "1px",
|
|
310
|
+
background: "oklch(0.9900 0 0)",
|
|
311
|
+
"shadow-blur": "2px",
|
|
312
|
+
"card-foreground": "oklch(0 0 0)",
|
|
313
|
+
card: "oklch(1 0 0)",
|
|
314
|
+
primary: "oklch(0 0 0)"
|
|
315
|
+
},
|
|
316
|
+
dark: {
|
|
317
|
+
ring: "oklch(0.7200 0 0)",
|
|
318
|
+
"chart-4": "oklch(0.4400 0 0)",
|
|
319
|
+
"chart-3": "oklch(0.5600 0 0)",
|
|
320
|
+
"secondary-foreground": "oklch(1 0 0)",
|
|
321
|
+
"chart-5": "oklch(0.9200 0 0)",
|
|
322
|
+
foreground: "oklch(1 0 0)",
|
|
323
|
+
"shadow-spread": "0px",
|
|
324
|
+
"chart-2": "oklch(0.5800 0.2100 260.8400)",
|
|
325
|
+
"accent-foreground": "oklch(1 0 0)",
|
|
326
|
+
"chart-1": "oklch(0.8100 0.1700 75.3500)",
|
|
327
|
+
"muted-foreground": "oklch(0.7200 0 0)",
|
|
328
|
+
"font-mono": "Geist Mono, monospace",
|
|
329
|
+
sidebar: "oklch(0.1800 0 0)",
|
|
330
|
+
"popover-foreground": "oklch(1 0 0)",
|
|
331
|
+
radius: "0.625rem",
|
|
332
|
+
muted: "oklch(0.2300 0 0)",
|
|
333
|
+
border: "oklch(0.2600 0 0)",
|
|
334
|
+
"primary-foreground": "oklch(0 0 0)",
|
|
335
|
+
popover: "oklch(0.1800 0 0)",
|
|
336
|
+
"font-sans": "Geist, sans-serif",
|
|
337
|
+
"shadow-color": "oklch(0 0 0)",
|
|
338
|
+
"shadow-opacity": "0.1",
|
|
339
|
+
"sidebar-border": "oklch(0.3200 0 0)",
|
|
340
|
+
"sidebar-primary": "oklch(1 0 0)",
|
|
341
|
+
"sidebar-primary-foreground": "oklch(0 0 0)",
|
|
342
|
+
accent: "oklch(0.3200 0 0)",
|
|
343
|
+
"font-serif": "Georgia, serif",
|
|
344
|
+
destructive: "oklch(0.6900 0.2000 23.9100)",
|
|
345
|
+
secondary: "oklch(0.2500 0 0)",
|
|
346
|
+
"sidebar-foreground": "oklch(1 0 0)",
|
|
347
|
+
"sidebar-accent-foreground": "oklch(1 0 0)",
|
|
348
|
+
input: "oklch(0.3200 0 0)",
|
|
349
|
+
"shadow-offset-x": "0",
|
|
350
|
+
"sidebar-ring": "oklch(0.7200 0 0)",
|
|
351
|
+
"sidebar-accent": "oklch(0.3200 0 0)",
|
|
352
|
+
"destructive-foreground": "oklch(0 0 0)",
|
|
353
|
+
"shadow-offset-y": "1px",
|
|
354
|
+
background: "oklch(0 0 0)",
|
|
355
|
+
"shadow-blur": "3px",
|
|
356
|
+
"card-foreground": "oklch(1 0 0)",
|
|
357
|
+
card: "oklch(0.1400 0 0)",
|
|
358
|
+
primary: "oklch(1 0 0)"
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
}, i = Symbol("ThemeState");
|
|
362
|
+
let d = null;
|
|
363
|
+
function k(a = "theme", e) {
|
|
364
|
+
const c = n(a), r = n(e ?? !1), h = () => {
|
|
365
|
+
if (typeof window > "u") return;
|
|
366
|
+
const o = s[c.value];
|
|
367
|
+
if (!o) return;
|
|
368
|
+
const l = r.value ? o.dark : o.light, t = document.documentElement;
|
|
369
|
+
Object.entries(l).forEach(([g, p]) => {
|
|
370
|
+
t.style.setProperty(`--theme-${g}`, p);
|
|
371
|
+
}), r.value ? t.classList.add("dark") : t.classList.remove("dark"), localStorage.setItem("ui-theme", c.value), localStorage.setItem("ui-dark-mode", String(r.value));
|
|
372
|
+
}, u = (o) => {
|
|
373
|
+
if (!s[o]) {
|
|
374
|
+
console.warn(`[theme-kit] Theme "${o}" does not exist.`);
|
|
375
|
+
return;
|
|
376
|
+
}
|
|
377
|
+
c.value = o, h();
|
|
378
|
+
}, f = (o) => {
|
|
379
|
+
r.value = o, h();
|
|
380
|
+
}, m = () => {
|
|
381
|
+
r.value = !r.value, h();
|
|
382
|
+
};
|
|
383
|
+
if (typeof window < "u") {
|
|
384
|
+
const o = localStorage.getItem("ui-theme"), l = localStorage.getItem("ui-dark-mode");
|
|
385
|
+
o && s[o] && (c.value = o), l !== null ? r.value = l === "true" : e === void 0 && (r.value = window.matchMedia("(prefers-color-scheme: dark)").matches), h();
|
|
386
|
+
}
|
|
387
|
+
return {
|
|
388
|
+
theme: c,
|
|
389
|
+
isDark: r,
|
|
390
|
+
setTheme: u,
|
|
391
|
+
setDarkMode: f,
|
|
392
|
+
toggleDarkMode: m
|
|
393
|
+
};
|
|
394
|
+
}
|
|
395
|
+
function w() {
|
|
396
|
+
const a = b(i, null);
|
|
397
|
+
return a || (typeof window < "u" ? (d || (d = k()), d) : {
|
|
398
|
+
theme: n("theme"),
|
|
399
|
+
isDark: n(!1),
|
|
400
|
+
setTheme: () => {
|
|
401
|
+
},
|
|
402
|
+
setDarkMode: () => {
|
|
403
|
+
},
|
|
404
|
+
toggleDarkMode: () => {
|
|
405
|
+
}
|
|
406
|
+
});
|
|
407
|
+
}
|
|
408
|
+
const v = {
|
|
409
|
+
install(a, e = {}) {
|
|
410
|
+
e.extraThemes && Object.assign(s, e.extraThemes);
|
|
411
|
+
const c = k(
|
|
412
|
+
e.defaultTheme || "theme",
|
|
413
|
+
e.defaultDark
|
|
414
|
+
);
|
|
415
|
+
a.provide(i, c);
|
|
416
|
+
}
|
|
417
|
+
};
|
|
418
|
+
export {
|
|
419
|
+
v as themePlugin,
|
|
420
|
+
w as useTheme
|
|
421
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(c,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(c=typeof globalThis<"u"?globalThis:c||self,e(c.VueTailwindThemeKit={},c.Vue))})(this,function(c,e){"use strict";const s={theme:{name:"theme",light:{background:"oklch(1 0 0)",foreground:"oklch(0.145 0 0)",card:"oklch(1 0 0)","card-foreground":"oklch(0.145 0 0)",popover:"oklch(1 0 0)","popover-foreground":"oklch(0.145 0 0)",primary:"oklch(0.205 0 0)","primary-foreground":"oklch(0.985 0 0)",secondary:"oklch(0.97 0 0)","secondary-foreground":"oklch(0.205 0 0)",muted:"oklch(0.97 0 0)","muted-foreground":"oklch(0.556 0 0)",accent:"oklch(0.97 0 0)","accent-foreground":"oklch(0.205 0 0)",destructive:"oklch(0.577 0.245 27.325)","destructive-foreground":"oklch(1 0 0)",border:"oklch(0.922 0 0)",input:"oklch(0.922 0 0)",ring:"oklch(0.708 0 0)","chart-1":"oklch(0.81 0.10 252)","chart-2":"oklch(0.62 0.19 260)","chart-3":"oklch(0.55 0.22 263)","chart-4":"oklch(0.49 0.22 264)","chart-5":"oklch(0.42 0.18 266)",radius:"0.625rem",spacing:"0.25rem","letter-spacing":"0em","shadow-color":"oklch(0 0 0)","shadow-opacity":"0.1","shadow-blur":"3px","shadow-spread":"0px","shadow-offset-x":"0","shadow-offset-y":"1px","font-sans":"ui-sans-serif, system-ui, sans-serif","font-serif":"ui-serif, Georgia, serif","font-mono":"ui-monospace, SFMono-Regular, monospace"},dark:{background:"oklch(0.145 0 0)",foreground:"oklch(0.985 0 0)",card:"oklch(0.205 0 0)","card-foreground":"oklch(0.985 0 0)",popover:"oklch(0.205 0 0)","popover-foreground":"oklch(0.985 0 0)",primary:"oklch(0.922 0 0)","primary-foreground":"oklch(0.205 0 0)",secondary:"oklch(0.269 0 0)","secondary-foreground":"oklch(0.985 0 0)",muted:"oklch(0.269 0 0)","muted-foreground":"oklch(0.708 0 0)",accent:"oklch(0.269 0 0)","accent-foreground":"oklch(0.985 0 0)",destructive:"oklch(0.577 0.245 27.325)","destructive-foreground":"oklch(1 0 0)",border:"oklch(0.269 0 0)",input:"oklch(0.269 0 0)",ring:"oklch(0.556 0 0)","chart-1":"oklch(0.81 0.10 252)","chart-2":"oklch(0.62 0.19 260)","chart-3":"oklch(0.55 0.22 263)","chart-4":"oklch(0.49 0.22 264)","chart-5":"oklch(0.42 0.18 266)",radius:"0.625rem",spacing:"0.25rem","letter-spacing":"0em","shadow-color":"oklch(0 0 0)","shadow-opacity":"0.2","shadow-blur":"4px","shadow-spread":"0px","shadow-offset-x":"0","shadow-offset-y":"2px","font-sans":"ui-sans-serif, system-ui, sans-serif","font-serif":"ui-serif, Georgia, serif","font-mono":"ui-monospace, SFMono-Regular, monospace"}},claude:{name:"claude",light:{ring:"oklch(0.6171 0.1375 39.0427)","chart-4":"oklch(0.8822 0.0403 298.1792)","chart-3":"oklch(0.8816 0.0276 93.1280)","secondary-foreground":"oklch(0.4334 0.0177 98.6048)","chart-5":"oklch(0.5608 0.1348 42.0584)",foreground:"oklch(0.3438 0.0269 95.7226)","shadow-spread":"0px","chart-2":"oklch(0.6898 0.1581 290.4107)","accent-foreground":"oklch(0.2671 0.0196 98.9390)","chart-1":"oklch(0.5583 0.1276 42.9956)","muted-foreground":"oklch(0.6059 0.0075 97.4233)","font-mono":'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',spacing:"0.25rem",sidebar:"oklch(0.9663 0.0080 98.8792)","popover-foreground":"oklch(0.2671 0.0196 98.9390)",radius:"0.5rem",muted:"oklch(0.9341 0.0153 90.2390)",border:"oklch(0.8847 0.0069 97.3627)","primary-foreground":"oklch(1.0000 0 0)",popover:"oklch(1.0000 0 0)","font-sans":"ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'","letter-spacing":"0em","shadow-color":"oklch(0 0 0)","shadow-opacity":"0.1","sidebar-border":"oklch(0.9401 0 0)","sidebar-primary":"oklch(0.6171 0.1375 39.0427)","sidebar-primary-foreground":"oklch(0.9881 0 0)",accent:"oklch(0.9245 0.0138 92.9892)","font-serif":'ui-serif, Georgia, Cambria, "Times New Roman", Times, serif',destructive:"oklch(0.1908 0.0020 106.5859)",secondary:"oklch(0.9245 0.0138 92.9892)","sidebar-foreground":"oklch(0.3590 0.0051 106.6524)","sidebar-accent-foreground":"oklch(0.3250 0 0)",input:"oklch(0.7621 0.0156 98.3528)","shadow-offset-x":"0","sidebar-ring":"oklch(0.7731 0 0)","sidebar-accent":"oklch(0.9245 0.0138 92.9892)","destructive-foreground":"oklch(1.0000 0 0)","shadow-offset-y":"1px",background:"oklch(0.9818 0.0054 95.0986)","shadow-blur":"3px","card-foreground":"oklch(0.1908 0.0020 106.5859)",card:"oklch(0.9818 0.0054 95.0986)",primary:"oklch(0.6171 0.1375 39.0427)"},dark:{ring:"oklch(0.6724 0.1308 38.7559)","chart-4":"oklch(0.3074 0.0516 289.3230)","chart-3":"oklch(0.2130 0.0078 95.4245)","secondary-foreground":"oklch(0.3085 0.0035 106.6039)","chart-5":"oklch(0.5608 0.1348 42.0584)",foreground:"oklch(0.8074 0.0142 93.0137)","shadow-spread":"0px","chart-2":"oklch(0.6898 0.1581 290.4107)","accent-foreground":"oklch(0.9663 0.0080 98.8792)","chart-1":"oklch(0.5583 0.1276 42.9956)","muted-foreground":"oklch(0.7713 0.0169 99.0657)","font-mono":'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',sidebar:"oklch(0.2357 0.0024 67.7077)","popover-foreground":"oklch(0.9211 0.0040 106.4781)",radius:"0.625rem",muted:"oklch(0.2213 0.0038 106.7070)",border:"oklch(0.3618 0.0101 106.8928)","primary-foreground":"oklch(1.0000 0 0)",popover:"oklch(0.3085 0.0035 106.6039)","font-sans":"ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'","shadow-color":"oklch(0 0 0)","shadow-opacity":"0.1","sidebar-border":"oklch(0.9401 0 0)","sidebar-primary":"oklch(0.3250 0 0)","sidebar-primary-foreground":"oklch(0.9881 0 0)",accent:"oklch(0.2130 0.0078 95.4245)","font-serif":'ui-serif, Georgia, Cambria, "Times New Roman", Times, serif',destructive:"oklch(0.6368 0.2078 25.3313)",secondary:"oklch(0.9818 0.0054 95.0986)","sidebar-foreground":"oklch(0.8074 0.0142 93.0137)","sidebar-accent-foreground":"oklch(0.8074 0.0142 93.0137)",input:"oklch(0.4336 0.0113 100.2195)","shadow-offset-x":"0","sidebar-ring":"oklch(0.7731 0 0)","sidebar-accent":"oklch(0.1680 0.0020 106.6177)","destructive-foreground":"oklch(1.0000 0 0)","shadow-offset-y":"1px",background:"oklch(0.2679 0.0036 106.6427)","shadow-blur":"3px","card-foreground":"oklch(0.9818 0.0054 95.0986)",card:"oklch(0.2679 0.0036 106.6427)",primary:"oklch(0.6724 0.1308 38.7559)"}},twitter:{name:"twitter",light:{ring:"oklch(0.6818 0.1584 243.3540)","chart-4":"oklch(0.7064 0.1822 151.7125)","chart-3":"oklch(0.8214 0.1600 82.5337)","secondary-foreground":"oklch(1.0000 0 0)","chart-5":"oklch(0.5919 0.2186 10.5826)",foreground:"oklch(0.1884 0.0128 248.5103)","shadow-spread":"0px","chart-2":"oklch(0.6907 0.1554 160.3454)","accent-foreground":"oklch(0.6723 0.1606 244.9955)","chart-1":"oklch(0.6723 0.1606 244.9955)","muted-foreground":"oklch(0.1884 0.0128 248.5103)","font-mono":"Menlo, monospace",spacing:"0.25rem",sidebar:"oklch(0.9784 0.0011 197.1387)","popover-foreground":"oklch(0.1884 0.0128 248.5103)",radius:"1.3rem",muted:"oklch(0.9222 0.0013 286.3737)",border:"oklch(0.9317 0.0118 231.6594)","primary-foreground":"oklch(1.0000 0 0)",popover:"oklch(1.0000 0 0)","font-sans":"Open Sans, sans-serif","letter-spacing":"0em","shadow-color":"rgba(29,161,242,0.15)","shadow-opacity":"0","sidebar-border":"oklch(0.9271 0.0101 238.5177)","sidebar-primary":"oklch(0.6723 0.1606 244.9955)","sidebar-primary-foreground":"oklch(1.0000 0 0)",accent:"oklch(0.9392 0.0166 250.8453)","font-serif":"Georgia, serif",destructive:"oklch(0.6188 0.2376 25.7658)",secondary:"oklch(0.1884 0.0128 248.5103)","sidebar-foreground":"oklch(0.1884 0.0128 248.5103)","sidebar-accent-foreground":"oklch(0.6723 0.1606 244.9955)",input:"oklch(0.9809 0.0025 228.7836)","shadow-offset-x":"0px","sidebar-ring":"oklch(0.6818 0.1584 243.3540)","sidebar-accent":"oklch(0.9392 0.0166 250.8453)","destructive-foreground":"oklch(1.0000 0 0)","shadow-offset-y":"2px",background:"oklch(1.0000 0 0)","shadow-blur":"0px","card-foreground":"oklch(0.1884 0.0128 248.5103)",card:"oklch(0.9784 0.0011 197.1387)",primary:"oklch(0.6723 0.1606 244.9955)"},dark:{ring:"oklch(0.6818 0.1584 243.3540)","chart-4":"oklch(0.7064 0.1822 151.7125)","chart-3":"oklch(0.8214 0.1600 82.5337)","secondary-foreground":"oklch(0.1884 0.0128 248.5103)","chart-5":"oklch(0.5919 0.2186 10.5826)",foreground:"oklch(0.9328 0.0025 228.7857)","shadow-spread":"0px","chart-2":"oklch(0.6907 0.1554 160.3454)","accent-foreground":"oklch(0.6692 0.1607 245.0110)","chart-1":"oklch(0.6723 0.1606 244.9955)","muted-foreground":"oklch(0.5637 0.0078 247.9662)","font-mono":'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',sidebar:"oklch(0.2097 0.0080 274.5332)","popover-foreground":"oklch(0.9328 0.0025 228.7857)",radius:"0.625rem",muted:"oklch(0.2090 0 0)",border:"oklch(0.2674 0.0047 248.0045)","primary-foreground":"oklch(1.0000 0 0)",popover:"oklch(0 0 0)","font-sans":"ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'","shadow-color":"rgba(29,161,242,0.25)","shadow-opacity":"0.1","sidebar-border":"oklch(0.3795 0.0220 240.5943)","sidebar-primary":"oklch(0.6818 0.1584 243.3540)","sidebar-primary-foreground":"oklch(1.0000 0 0)",accent:"oklch(0.1928 0.0331 242.5459)","font-serif":'ui-serif, Georgia, Cambria, "Times New Roman", Times, serif',destructive:"oklch(0.6188 0.2376 25.7658)",secondary:"oklch(0.9622 0.0035 219.5331)","sidebar-foreground":"oklch(0.8853 0 0)","sidebar-accent-foreground":"oklch(0.6692 0.1607 245.0110)",input:"oklch(0.3020 0.0288 244.8244)","shadow-offset-x":"0","sidebar-ring":"oklch(0.6818 0.1584 243.3540)","sidebar-accent":"oklch(0.1928 0.0331 242.5459)","destructive-foreground":"oklch(1.0000 0 0)","shadow-offset-y":"1px",background:"oklch(0 0 0)","shadow-blur":"3px","card-foreground":"oklch(0.8853 0 0)",card:"oklch(0.2097 0.0080 274.5332)",primary:"oklch(0.6692 0.1607 245.0110)"}},vercel:{name:"vercel",light:{ring:"oklch(0 0 0)","chart-4":"oklch(0.9200 0 0)","chart-3":"oklch(0.7200 0 0)","secondary-foreground":"oklch(0 0 0)","chart-5":"oklch(0.5600 0 0)",foreground:"oklch(0 0 0)","shadow-spread":"0px","chart-2":"oklch(0.5500 0.2200 264.5300)","accent-foreground":"oklch(0 0 0)","chart-1":"oklch(0.8100 0.1700 75.3500)","muted-foreground":"oklch(0.4400 0 0)","font-mono":"Geist Mono, monospace",spacing:"0.25rem",sidebar:"oklch(0.9900 0 0)","popover-foreground":"oklch(0 0 0)",radius:"0.5rem",muted:"oklch(0.9700 0 0)",border:"oklch(0.9200 0 0)","primary-foreground":"oklch(1 0 0)",popover:"oklch(0.9900 0 0)","font-sans":"Geist, sans-serif","letter-spacing":"0em","shadow-color":"hsl(0 0% 0%)","shadow-opacity":"0.18","sidebar-border":"oklch(0.9400 0 0)","sidebar-primary":"oklch(0 0 0)","sidebar-primary-foreground":"oklch(1 0 0)",accent:"oklch(0.9400 0 0)","font-serif":"Georgia, serif",destructive:"oklch(0.6300 0.1900 23.0300)",secondary:"oklch(0.9400 0 0)","sidebar-foreground":"oklch(0 0 0)","sidebar-accent-foreground":"oklch(0 0 0)",input:"oklch(0.9400 0 0)","shadow-offset-x":"0px","sidebar-ring":"oklch(0 0 0)","sidebar-accent":"oklch(0.9400 0 0)","destructive-foreground":"oklch(1 0 0)","shadow-offset-y":"1px",background:"oklch(0.9900 0 0)","shadow-blur":"2px","card-foreground":"oklch(0 0 0)",card:"oklch(1 0 0)",primary:"oklch(0 0 0)"},dark:{ring:"oklch(0.7200 0 0)","chart-4":"oklch(0.4400 0 0)","chart-3":"oklch(0.5600 0 0)","secondary-foreground":"oklch(1 0 0)","chart-5":"oklch(0.9200 0 0)",foreground:"oklch(1 0 0)","shadow-spread":"0px","chart-2":"oklch(0.5800 0.2100 260.8400)","accent-foreground":"oklch(1 0 0)","chart-1":"oklch(0.8100 0.1700 75.3500)","muted-foreground":"oklch(0.7200 0 0)","font-mono":"Geist Mono, monospace",sidebar:"oklch(0.1800 0 0)","popover-foreground":"oklch(1 0 0)",radius:"0.625rem",muted:"oklch(0.2300 0 0)",border:"oklch(0.2600 0 0)","primary-foreground":"oklch(0 0 0)",popover:"oklch(0.1800 0 0)","font-sans":"Geist, sans-serif","shadow-color":"oklch(0 0 0)","shadow-opacity":"0.1","sidebar-border":"oklch(0.3200 0 0)","sidebar-primary":"oklch(1 0 0)","sidebar-primary-foreground":"oklch(0 0 0)",accent:"oklch(0.3200 0 0)","font-serif":"Georgia, serif",destructive:"oklch(0.6900 0.2000 23.9100)",secondary:"oklch(0.2500 0 0)","sidebar-foreground":"oklch(1 0 0)","sidebar-accent-foreground":"oklch(1 0 0)",input:"oklch(0.3200 0 0)","shadow-offset-x":"0","sidebar-ring":"oklch(0.7200 0 0)","sidebar-accent":"oklch(0.3200 0 0)","destructive-foreground":"oklch(0 0 0)","shadow-offset-y":"1px",background:"oklch(0 0 0)","shadow-blur":"3px","card-foreground":"oklch(1 0 0)",card:"oklch(0.1400 0 0)",primary:"oklch(1 0 0)"}}},k=Symbol("ThemeState");let d=null;function u(l="theme",a){const h=e.ref(l),r=e.ref(a??!1),n=()=>{if(typeof window>"u")return;const o=s[h.value];if(!o)return;const t=r.value?o.dark:o.light,i=document.documentElement;Object.entries(t).forEach(([y,w])=>{i.style.setProperty(`--theme-${y}`,w)}),r.value?i.classList.add("dark"):i.classList.remove("dark"),localStorage.setItem("ui-theme",h.value),localStorage.setItem("ui-dark-mode",String(r.value))},g=o=>{if(!s[o]){console.warn(`[theme-kit] Theme "${o}" does not exist.`);return}h.value=o,n()},p=o=>{r.value=o,n()},b=()=>{r.value=!r.value,n()};if(typeof window<"u"){const o=localStorage.getItem("ui-theme"),t=localStorage.getItem("ui-dark-mode");o&&s[o]&&(h.value=o),t!==null?r.value=t==="true":a===void 0&&(r.value=window.matchMedia("(prefers-color-scheme: dark)").matches),n()}return{theme:h,isDark:r,setTheme:g,setDarkMode:p,toggleDarkMode:b}}function f(){const l=e.inject(k,null);return l||(typeof window<"u"?(d||(d=u()),d):{theme:e.ref("theme"),isDark:e.ref(!1),setTheme:()=>{},setDarkMode:()=>{},toggleDarkMode:()=>{}})}const m={install(l,a={}){a.extraThemes&&Object.assign(s,a.extraThemes);const h=u(a.defaultTheme||"theme",a.defaultDark);l.provide(k,h)}};c.themePlugin=m,c.useTheme=f,Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type ThemeColors = Record<string, string>;
|
|
2
|
+
export interface ThemeConfig {
|
|
3
|
+
name: string;
|
|
4
|
+
light: ThemeColors;
|
|
5
|
+
dark: ThemeColors;
|
|
6
|
+
}
|
|
7
|
+
export interface PluginOptions {
|
|
8
|
+
defaultTheme?: string;
|
|
9
|
+
defaultDark?: boolean;
|
|
10
|
+
extraThemes?: Record<string, ThemeConfig>;
|
|
11
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@zeldafox/vue-tailwind-theme-kit",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "A dynamic theme library for Vue 3 and TailwindCSS",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.umd.js",
|
|
7
|
+
"module": "./dist/index.es.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.es.js",
|
|
13
|
+
"require": "./dist/index.umd.js"
|
|
14
|
+
},
|
|
15
|
+
"./preset": "./preset.cjs"
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"dist",
|
|
19
|
+
"preset.cjs"
|
|
20
|
+
],
|
|
21
|
+
"scripts": {
|
|
22
|
+
"build": "vite build"
|
|
23
|
+
},
|
|
24
|
+
"peerDependencies": {
|
|
25
|
+
"vue": "^3.0.0"
|
|
26
|
+
},
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"@types/node": "^20.0.0",
|
|
29
|
+
"@vitejs/plugin-vue": "^5.0.0",
|
|
30
|
+
"typescript": "^5.0.0",
|
|
31
|
+
"vite": "^5.0.0",
|
|
32
|
+
"vite-plugin-dts": "^3.0.0",
|
|
33
|
+
"vue": "^3.0.0"
|
|
34
|
+
}
|
|
35
|
+
}
|
package/preset.cjs
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/** @type {import('tailwindcss').Config} */
|
|
2
|
+
module.exports = {
|
|
3
|
+
darkMode: "class",
|
|
4
|
+
theme: {
|
|
5
|
+
extend: {
|
|
6
|
+
colors: {
|
|
7
|
+
background: "var(--theme-background)",
|
|
8
|
+
foreground: "var(--theme-foreground)",
|
|
9
|
+
card: {
|
|
10
|
+
DEFAULT: "var(--theme-card)",
|
|
11
|
+
foreground: "var(--theme-card-foreground)",
|
|
12
|
+
},
|
|
13
|
+
popover: {
|
|
14
|
+
DEFAULT: "var(--theme-popover)",
|
|
15
|
+
foreground: "var(--theme-popover-foreground)",
|
|
16
|
+
},
|
|
17
|
+
primary: {
|
|
18
|
+
DEFAULT: "var(--theme-primary)",
|
|
19
|
+
foreground: "var(--theme-primary-foreground)",
|
|
20
|
+
},
|
|
21
|
+
secondary: {
|
|
22
|
+
DEFAULT: "var(--theme-secondary)",
|
|
23
|
+
foreground: "var(--theme-secondary-foreground)",
|
|
24
|
+
},
|
|
25
|
+
muted: {
|
|
26
|
+
DEFAULT: "var(--theme-muted)",
|
|
27
|
+
foreground: "var(--theme-muted-foreground)",
|
|
28
|
+
},
|
|
29
|
+
accent: {
|
|
30
|
+
DEFAULT: "var(--theme-accent)",
|
|
31
|
+
foreground: "var(--theme-accent-foreground)",
|
|
32
|
+
},
|
|
33
|
+
destructive: {
|
|
34
|
+
DEFAULT: "var(--theme-destructive)",
|
|
35
|
+
foreground: "var(--theme-destructive-foreground)",
|
|
36
|
+
},
|
|
37
|
+
border: "var(--theme-border)",
|
|
38
|
+
input: "var(--theme-input)",
|
|
39
|
+
ring: "var(--theme-ring)",
|
|
40
|
+
chart: {
|
|
41
|
+
1: "var(--theme-chart-1)",
|
|
42
|
+
2: "var(--theme-chart-2)",
|
|
43
|
+
3: "var(--theme-chart-3)",
|
|
44
|
+
4: "var(--theme-chart-4)",
|
|
45
|
+
5: "var(--theme-chart-5)",
|
|
46
|
+
},
|
|
47
|
+
sidebar: {
|
|
48
|
+
DEFAULT: "var(--theme-sidebar)",
|
|
49
|
+
foreground: "var(--theme-sidebar-foreground)",
|
|
50
|
+
primary: "var(--theme-sidebar-primary)",
|
|
51
|
+
"primary-foreground": "var(--theme-sidebar-primary-foreground)",
|
|
52
|
+
accent: "var(--theme-sidebar-accent)",
|
|
53
|
+
"accent-foreground": "var(--theme-sidebar-accent-foreground)",
|
|
54
|
+
border: "var(--theme-sidebar-border)",
|
|
55
|
+
ring: "var(--theme-sidebar-ring)",
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
borderRadius: {
|
|
59
|
+
lg: "var(--theme-radius)",
|
|
60
|
+
md: "calc(var(--theme-radius) - 2px)",
|
|
61
|
+
sm: "calc(var(--theme-radius) - 4px)",
|
|
62
|
+
},
|
|
63
|
+
fontFamily: {
|
|
64
|
+
sans: "var(--theme-font-sans)",
|
|
65
|
+
serif: "var(--theme-font-serif)",
|
|
66
|
+
mono: "var(--theme-font-mono)",
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
};
|