@alliance-droid/svelte-docs-system 0.0.1
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/COMPONENTS.md +365 -0
- package/COVERAGE_REPORT.md +663 -0
- package/README.md +42 -0
- package/SEARCH_VERIFICATION.md +229 -0
- package/TEST_SUMMARY.md +344 -0
- package/bin/init.js +821 -0
- package/docs/E2E_TESTS.md +354 -0
- package/docs/TESTING.md +754 -0
- package/docs/de/index.md +41 -0
- package/docs/en/COMPONENTS.md +443 -0
- package/docs/en/api/examples.md +100 -0
- package/docs/en/api/overview.md +69 -0
- package/docs/en/components/index.md +622 -0
- package/docs/en/config/navigation.md +505 -0
- package/docs/en/config/theme-and-colors.md +395 -0
- package/docs/en/getting-started/integration.md +406 -0
- package/docs/en/guides/common-setups.md +651 -0
- package/docs/en/index.md +243 -0
- package/docs/en/markdown.md +102 -0
- package/docs/en/routing.md +64 -0
- package/docs/en/setup.md +52 -0
- package/docs/en/troubleshooting.md +704 -0
- package/docs/es/index.md +41 -0
- package/docs/fr/index.md +41 -0
- package/docs/ja/index.md +41 -0
- package/package.json +40 -0
- package/pagefind.toml +8 -0
- package/postcss.config.js +5 -0
- package/src/app.css +119 -0
- package/src/app.d.ts +13 -0
- package/src/app.html +11 -0
- package/src/lib/assets/favicon.svg +1 -0
- package/src/lib/components/APITable.svelte +120 -0
- package/src/lib/components/APITable.test.ts +153 -0
- package/src/lib/components/Breadcrumbs.svelte +85 -0
- package/src/lib/components/Breadcrumbs.test.ts +148 -0
- package/src/lib/components/Callout.svelte +60 -0
- package/src/lib/components/Callout.test.ts +100 -0
- package/src/lib/components/CodeBlock.svelte +68 -0
- package/src/lib/components/CodeBlock.test.ts +133 -0
- package/src/lib/components/DocLayout.svelte +84 -0
- package/src/lib/components/Footer.svelte +78 -0
- package/src/lib/components/Image.svelte +100 -0
- package/src/lib/components/Image.test.ts +163 -0
- package/src/lib/components/Navbar.svelte +141 -0
- package/src/lib/components/Search.svelte +248 -0
- package/src/lib/components/Sidebar.svelte +110 -0
- package/src/lib/components/Tabs.svelte +48 -0
- package/src/lib/components/Tabs.test.ts +102 -0
- package/src/lib/config.test.ts +140 -0
- package/src/lib/config.ts +179 -0
- package/src/lib/configIntegration.test.ts +272 -0
- package/src/lib/configLoader.ts +231 -0
- package/src/lib/configParser.test.ts +217 -0
- package/src/lib/configParser.ts +234 -0
- package/src/lib/index.ts +34 -0
- package/src/lib/integration.test.ts +426 -0
- package/src/lib/navigationBuilder.test.ts +338 -0
- package/src/lib/navigationBuilder.ts +268 -0
- package/src/lib/performance.test.ts +369 -0
- package/src/lib/routing.test.ts +202 -0
- package/src/lib/routing.ts +127 -0
- package/src/lib/search-functionality.test.ts +493 -0
- package/src/lib/stores/i18n.test.ts +180 -0
- package/src/lib/stores/i18n.ts +143 -0
- package/src/lib/stores/nav.ts +36 -0
- package/src/lib/stores/search.test.ts +140 -0
- package/src/lib/stores/search.ts +162 -0
- package/src/lib/stores/theme.ts +59 -0
- package/src/lib/stores/version.test.ts +139 -0
- package/src/lib/stores/version.ts +111 -0
- package/src/lib/themeCustomization.test.ts +223 -0
- package/src/lib/themeCustomization.ts +212 -0
- package/src/lib/utils/highlight.test.ts +136 -0
- package/src/lib/utils/highlight.ts +100 -0
- package/src/lib/utils/index.ts +7 -0
- package/src/lib/utils/markdown.test.ts +357 -0
- package/src/lib/utils/markdown.ts +77 -0
- package/src/routes/+layout.server.ts +1 -0
- package/src/routes/+layout.svelte +28 -0
- package/src/routes/+page.svelte +165 -0
- package/static/robots.txt +3 -0
- package/svelte.config.js +18 -0
- package/tailwind.config.ts +55 -0
- package/template-starter/.github/workflows/build.yml +40 -0
- package/template-starter/.github/workflows/deploy-github-pages.yml +47 -0
- package/template-starter/.github/workflows/deploy-netlify.yml +41 -0
- package/template-starter/.github/workflows/deploy-vercel.yml +64 -0
- package/template-starter/NPM-PACKAGE-SETUP.md +233 -0
- package/template-starter/README.md +320 -0
- package/template-starter/docs/_config.json +39 -0
- package/template-starter/docs/api/components.md +257 -0
- package/template-starter/docs/api/overview.md +169 -0
- package/template-starter/docs/guides/configuration.md +145 -0
- package/template-starter/docs/guides/github-pages-deployment.md +254 -0
- package/template-starter/docs/guides/netlify-deployment.md +159 -0
- package/template-starter/docs/guides/vercel-deployment.md +131 -0
- package/template-starter/docs/index.md +49 -0
- package/template-starter/docs/setup.md +149 -0
- package/template-starter/package.json +31 -0
- package/template-starter/pagefind.toml +3 -0
- package/template-starter/postcss.config.js +5 -0
- package/template-starter/src/app.css +34 -0
- package/template-starter/src/app.d.ts +13 -0
- package/template-starter/src/app.html +11 -0
- package/template-starter/src/lib/components/APITable.svelte +120 -0
- package/template-starter/src/lib/components/APITable.test.ts +19 -0
- package/template-starter/src/lib/components/Breadcrumbs.svelte +85 -0
- package/template-starter/src/lib/components/Breadcrumbs.test.ts +19 -0
- package/template-starter/src/lib/components/Callout.svelte +60 -0
- package/template-starter/src/lib/components/Callout.test.ts +16 -0
- package/template-starter/src/lib/components/CodeBlock.svelte +68 -0
- package/template-starter/src/lib/components/CodeBlock.test.ts +12 -0
- package/template-starter/src/lib/components/DocLayout.svelte +84 -0
- package/template-starter/src/lib/components/Footer.svelte +78 -0
- package/template-starter/src/lib/components/Image.svelte +100 -0
- package/template-starter/src/lib/components/Image.test.ts +15 -0
- package/template-starter/src/lib/components/Navbar.svelte +141 -0
- package/template-starter/src/lib/components/Search.svelte +248 -0
- package/template-starter/src/lib/components/Sidebar.svelte +110 -0
- package/template-starter/src/lib/components/Tabs.svelte +48 -0
- package/template-starter/src/lib/components/Tabs.test.ts +17 -0
- package/template-starter/src/lib/index.ts +15 -0
- package/template-starter/src/routes/+layout.svelte +28 -0
- package/template-starter/src/routes/+page.svelte +92 -0
- package/template-starter/svelte.config.js +17 -0
- package/template-starter/tailwind.config.ts +17 -0
- package/template-starter/tsconfig.json +13 -0
- package/template-starter/vite.config.ts +6 -0
- package/tests/e2e/example.spec.ts +345 -0
- package/tsconfig.json +20 -0
- package/vite.config.ts +6 -0
- package/vitest.config.ts +34 -0
- package/vitest.setup.ts +21 -0
|
@@ -0,0 +1,395 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Theme and Colors Configuration
|
|
3
|
+
description: Customize colors, fonts, and appearance
|
|
4
|
+
author: Andrew
|
|
5
|
+
date: 2026-02-05
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Theme and Colors Configuration
|
|
9
|
+
|
|
10
|
+
Learn how to customize the theme colors and appearance of your documentation site.
|
|
11
|
+
|
|
12
|
+
## Quick Start
|
|
13
|
+
|
|
14
|
+
The SvelteKit Documentation System comes with the Claude Code color palette built-in. To customize colors, edit your `tailwind.config.ts`:
|
|
15
|
+
|
|
16
|
+
```typescript
|
|
17
|
+
import type { Config } from 'tailwindcss';
|
|
18
|
+
|
|
19
|
+
export default {
|
|
20
|
+
theme: {
|
|
21
|
+
extend: {
|
|
22
|
+
colors: {
|
|
23
|
+
'claude-bg': '#FFFFFF', // Light background
|
|
24
|
+
'claude-bg-secondary': '#F7F6F3', // Light secondary background
|
|
25
|
+
'claude-text': '#1A1A1A', // Light text
|
|
26
|
+
'claude-text-secondary': '#565656', // Light secondary text
|
|
27
|
+
'claude-border': '#ECECEC', // Light borders
|
|
28
|
+
'claude-accent': '#0066CC', // Light accent (blue)
|
|
29
|
+
'claude-accent-hover': '#0052A3', // Light accent hover
|
|
30
|
+
|
|
31
|
+
'claude-dark-bg': '#1A1A1A', // Dark background
|
|
32
|
+
'claude-dark-bg-secondary': '#2D2D2D', // Dark secondary background
|
|
33
|
+
'claude-dark-text': '#FFFFFF', // Dark text
|
|
34
|
+
'claude-dark-text-secondary': '#B0B0B0', // Dark secondary text
|
|
35
|
+
'claude-dark-border': '#3A3A3A', // Dark borders
|
|
36
|
+
'claude-dark-accent': '#4D94FF', // Dark accent (blue)
|
|
37
|
+
'claude-dark-accent-hover': '#6BA3FF', // Dark accent hover
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
darkMode: 'class',
|
|
42
|
+
plugins: [],
|
|
43
|
+
} satisfies Config;
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Color Palette Reference
|
|
47
|
+
|
|
48
|
+
### Light Mode Colors
|
|
49
|
+
|
|
50
|
+
| Color | Usage | Default Value |
|
|
51
|
+
|-------|-------|---------------|
|
|
52
|
+
| `claude-bg` | Main background | `#FFFFFF` |
|
|
53
|
+
| `claude-bg-secondary` | Secondary background (sidebar, cards) | `#F7F6F3` |
|
|
54
|
+
| `claude-text` | Primary text | `#1A1A1A` |
|
|
55
|
+
| `claude-text-secondary` | Secondary text (muted) | `#565656` |
|
|
56
|
+
| `claude-border` | Borders and dividers | `#ECECEC` |
|
|
57
|
+
| `claude-accent` | Links, buttons, highlights | `#0066CC` |
|
|
58
|
+
| `claude-accent-hover` | Hover state for accent | `#0052A3` |
|
|
59
|
+
|
|
60
|
+
### Dark Mode Colors
|
|
61
|
+
|
|
62
|
+
| Color | Usage | Default Value |
|
|
63
|
+
|-------|-------|---------------|
|
|
64
|
+
| `claude-dark-bg` | Main background | `#1A1A1A` |
|
|
65
|
+
| `claude-dark-bg-secondary` | Secondary background (sidebar, cards) | `#2D2D2D` |
|
|
66
|
+
| `claude-dark-text` | Primary text | `#FFFFFF` |
|
|
67
|
+
| `claude-dark-text-secondary` | Secondary text (muted) | `#B0B0B0` |
|
|
68
|
+
| `claude-dark-border` | Borders and dividers | `#3A3A3A` |
|
|
69
|
+
| `claude-dark-accent` | Links, buttons, highlights | `#4D94FF` |
|
|
70
|
+
| `claude-dark-accent-hover` | Hover state for accent | `#6BA3FF` |
|
|
71
|
+
|
|
72
|
+
## Customizing Your Palette
|
|
73
|
+
|
|
74
|
+
### Example: Using Your Brand Colors
|
|
75
|
+
|
|
76
|
+
If you want to use your own brand colors instead of Claude Code blue:
|
|
77
|
+
|
|
78
|
+
```typescript
|
|
79
|
+
export default {
|
|
80
|
+
theme: {
|
|
81
|
+
extend: {
|
|
82
|
+
colors: {
|
|
83
|
+
// Light mode - Warm brand palette
|
|
84
|
+
'claude-bg': '#FAFAF8',
|
|
85
|
+
'claude-bg-secondary': '#F3F0E6',
|
|
86
|
+
'claude-text': '#2C2416',
|
|
87
|
+
'claude-text-secondary': '#6B6457',
|
|
88
|
+
'claude-border': '#E8E3D3',
|
|
89
|
+
'claude-accent': '#D97706', // Amber
|
|
90
|
+
'claude-accent-hover': '#B45309',
|
|
91
|
+
|
|
92
|
+
// Dark mode - Dark with amber accent
|
|
93
|
+
'claude-dark-bg': '#1F1812',
|
|
94
|
+
'claude-dark-bg-secondary': '#2D2620',
|
|
95
|
+
'claude-dark-text': '#FDF6EE',
|
|
96
|
+
'claude-dark-text-secondary': '#D1CFC4',
|
|
97
|
+
'claude-dark-border': '#3D3530',
|
|
98
|
+
'claude-dark-accent': '#FBBF24', // Lighter amber
|
|
99
|
+
'claude-dark-accent-hover': '#FCD34D',
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
} satisfies Config;
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### Example: Green/Teal Theme
|
|
107
|
+
|
|
108
|
+
```typescript
|
|
109
|
+
export default {
|
|
110
|
+
theme: {
|
|
111
|
+
extend: {
|
|
112
|
+
colors: {
|
|
113
|
+
'claude-bg': '#FFFFFF',
|
|
114
|
+
'claude-bg-secondary': '#F0FFFE',
|
|
115
|
+
'claude-text': '#0F4C4F',
|
|
116
|
+
'claude-text-secondary': '#4A7C7E',
|
|
117
|
+
'claude-border': '#D1E8E7',
|
|
118
|
+
'claude-accent': '#059669', // Emerald
|
|
119
|
+
'claude-accent-hover': '#047857',
|
|
120
|
+
|
|
121
|
+
'claude-dark-bg': '#0F4C4F',
|
|
122
|
+
'claude-dark-bg-secondary': '#1A6B6E',
|
|
123
|
+
'claude-dark-text': '#ECFDF5',
|
|
124
|
+
'claude-dark-text-secondary': '#A7D8CC',
|
|
125
|
+
'claude-dark-border': '#2D7A76',
|
|
126
|
+
'claude-dark-accent': '#6EE7B7', // Light emerald
|
|
127
|
+
'claude-dark-accent-hover': '#A7F3D0',
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
} satisfies Config;
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## Global Styling
|
|
135
|
+
|
|
136
|
+
Edit `src/app.css` to customize global styles:
|
|
137
|
+
|
|
138
|
+
```css
|
|
139
|
+
@tailwind base;
|
|
140
|
+
@tailwind components;
|
|
141
|
+
@tailwind utilities;
|
|
142
|
+
|
|
143
|
+
@layer base {
|
|
144
|
+
/* Custom font sizes */
|
|
145
|
+
h1 {
|
|
146
|
+
@apply text-4xl font-bold mb-4;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
h2 {
|
|
150
|
+
@apply text-2xl font-bold mt-8 mb-3;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
p {
|
|
154
|
+
@apply text-lg leading-7 mb-4;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/* Custom link styling */
|
|
158
|
+
a {
|
|
159
|
+
@apply text-claude-accent hover:text-claude-accent-hover;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/* Code block styling */
|
|
163
|
+
code {
|
|
164
|
+
@apply bg-claude-bg-secondary px-2 py-1 rounded;
|
|
165
|
+
font-family: 'Monaco', 'Courier New', monospace;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
@layer components {
|
|
170
|
+
/* Custom components */
|
|
171
|
+
.doc-container {
|
|
172
|
+
@apply max-w-4xl mx-auto px-4 py-8;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.doc-section {
|
|
176
|
+
@apply mb-8 pb-8 border-b border-claude-border;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
## Dark Mode Configuration
|
|
182
|
+
|
|
183
|
+
The documentation system uses Tailwind's `class` strategy for dark mode. This means:
|
|
184
|
+
|
|
185
|
+
1. **Automatic detection:** Respects user's system preference
|
|
186
|
+
2. **Manual override:** Users can toggle with the theme button
|
|
187
|
+
3. **Persistence:** Theme preference is saved to localStorage
|
|
188
|
+
|
|
189
|
+
### How Dark Mode Works
|
|
190
|
+
|
|
191
|
+
The `theme` store in `src/lib/stores/theme.ts` manages the theme state:
|
|
192
|
+
|
|
193
|
+
```typescript
|
|
194
|
+
import { writable } from 'svelte/store';
|
|
195
|
+
|
|
196
|
+
type Theme = 'light' | 'dark' | 'system';
|
|
197
|
+
|
|
198
|
+
function createThemeStore() {
|
|
199
|
+
// Load from localStorage or default to 'system'
|
|
200
|
+
const stored = typeof localStorage !== 'undefined'
|
|
201
|
+
? localStorage.getItem('theme')
|
|
202
|
+
: 'system';
|
|
203
|
+
|
|
204
|
+
const { subscribe, set } = writable<Theme>(stored as Theme || 'system');
|
|
205
|
+
|
|
206
|
+
return {
|
|
207
|
+
subscribe,
|
|
208
|
+
set: (theme: Theme) => {
|
|
209
|
+
if (typeof document !== 'undefined') {
|
|
210
|
+
if (theme === 'dark') {
|
|
211
|
+
document.documentElement.classList.add('dark');
|
|
212
|
+
} else if (theme === 'light') {
|
|
213
|
+
document.documentElement.classList.remove('dark');
|
|
214
|
+
} else {
|
|
215
|
+
// System preference
|
|
216
|
+
if (window.matchMedia('(prefers-color-scheme: dark)').matches) {
|
|
217
|
+
document.documentElement.classList.add('dark');
|
|
218
|
+
} else {
|
|
219
|
+
document.documentElement.classList.remove('dark');
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
localStorage.setItem('theme', theme);
|
|
224
|
+
set(theme);
|
|
225
|
+
},
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
## Typography
|
|
231
|
+
|
|
232
|
+
The default typography uses system fonts for best performance:
|
|
233
|
+
|
|
234
|
+
```css
|
|
235
|
+
/* In src/app.css */
|
|
236
|
+
@layer base {
|
|
237
|
+
:root {
|
|
238
|
+
--font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
|
|
239
|
+
'Helvetica Neue', Arial, 'Noto Sans', sans-serif;
|
|
240
|
+
--font-mono: 'Menlo', 'Monaco', 'Courier New', monospace;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
body {
|
|
244
|
+
@apply font-sans;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
code,
|
|
248
|
+
pre {
|
|
249
|
+
@apply font-mono;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
### Using Custom Fonts
|
|
255
|
+
|
|
256
|
+
To use Google Fonts or other custom fonts:
|
|
257
|
+
|
|
258
|
+
1. Add to `src/app.html`:
|
|
259
|
+
|
|
260
|
+
```html
|
|
261
|
+
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
262
|
+
<link
|
|
263
|
+
rel="preconnect"
|
|
264
|
+
href="https://fonts.gstatic.com"
|
|
265
|
+
crossorigin
|
|
266
|
+
/>
|
|
267
|
+
<link
|
|
268
|
+
href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700&display=swap"
|
|
269
|
+
rel="stylesheet"
|
|
270
|
+
/>
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
2. Configure in `tailwind.config.ts`:
|
|
274
|
+
|
|
275
|
+
```typescript
|
|
276
|
+
export default {
|
|
277
|
+
theme: {
|
|
278
|
+
extend: {
|
|
279
|
+
fontFamily: {
|
|
280
|
+
sans: ['Poppins', 'system-ui', 'sans-serif'],
|
|
281
|
+
},
|
|
282
|
+
},
|
|
283
|
+
},
|
|
284
|
+
} satisfies Config;
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
## Spacing and Layout
|
|
288
|
+
|
|
289
|
+
Customize spacing in `tailwind.config.ts`:
|
|
290
|
+
|
|
291
|
+
```typescript
|
|
292
|
+
export default {
|
|
293
|
+
theme: {
|
|
294
|
+
extend: {
|
|
295
|
+
spacing: {
|
|
296
|
+
'128': '32rem',
|
|
297
|
+
'144': '36rem',
|
|
298
|
+
},
|
|
299
|
+
maxWidth: {
|
|
300
|
+
'prose': '65ch',
|
|
301
|
+
'full': '100%',
|
|
302
|
+
},
|
|
303
|
+
},
|
|
304
|
+
},
|
|
305
|
+
} satisfies Config;
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
## Component-Level Customization
|
|
309
|
+
|
|
310
|
+
### Customizing DocLayout
|
|
311
|
+
|
|
312
|
+
Edit `src/lib/components/DocLayout.svelte` to change:
|
|
313
|
+
- Sidebar width
|
|
314
|
+
- Navbar height
|
|
315
|
+
- Footer content
|
|
316
|
+
- Overall grid layout
|
|
317
|
+
|
|
318
|
+
Example modification:
|
|
319
|
+
|
|
320
|
+
```svelte
|
|
321
|
+
<div class="grid grid-cols-1 lg:grid-cols-4 gap-8">
|
|
322
|
+
<!-- Change sidebar width from col-span-3 to col-span-4 -->
|
|
323
|
+
<aside class="lg:col-span-1">
|
|
324
|
+
<Sidebar {sections} {currentPath} />
|
|
325
|
+
</aside>
|
|
326
|
+
<main class="lg:col-span-3">
|
|
327
|
+
<!-- Content -->
|
|
328
|
+
</main>
|
|
329
|
+
</div>
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
### Customizing Navbar
|
|
333
|
+
|
|
334
|
+
Edit `src/lib/components/Navbar.svelte` to change:
|
|
335
|
+
- Logo size
|
|
336
|
+
- Button styles
|
|
337
|
+
- Navigation items
|
|
338
|
+
- Color scheme
|
|
339
|
+
|
|
340
|
+
## CSS Variables
|
|
341
|
+
|
|
342
|
+
For even more control, use CSS custom properties:
|
|
343
|
+
|
|
344
|
+
```css
|
|
345
|
+
:root {
|
|
346
|
+
--color-bg: #ffffff;
|
|
347
|
+
--color-bg-secondary: #f7f6f3;
|
|
348
|
+
--color-text: #1a1a1a;
|
|
349
|
+
--color-border: #ececec;
|
|
350
|
+
--color-accent: #0066cc;
|
|
351
|
+
|
|
352
|
+
--radius-sm: 0.25rem;
|
|
353
|
+
--radius-md: 0.5rem;
|
|
354
|
+
--radius-lg: 1rem;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
.dark {
|
|
358
|
+
--color-bg: #1a1a1a;
|
|
359
|
+
--color-bg-secondary: #2d2d2d;
|
|
360
|
+
--color-text: #ffffff;
|
|
361
|
+
--color-border: #3a3a3a;
|
|
362
|
+
--color-accent: #4d94ff;
|
|
363
|
+
}
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
Then use in your components:
|
|
367
|
+
|
|
368
|
+
```svelte
|
|
369
|
+
<div class="bg-[var(--color-bg)] text-[var(--color-text)]">
|
|
370
|
+
Content
|
|
371
|
+
</div>
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
## Testing Your Changes
|
|
375
|
+
|
|
376
|
+
After updating colors:
|
|
377
|
+
|
|
378
|
+
1. **Check dev server:** `npm run dev`
|
|
379
|
+
2. **Test both themes:** Toggle dark mode in the UI
|
|
380
|
+
3. **Check contrast:** Ensure text is readable on all backgrounds
|
|
381
|
+
4. **Test on mobile:** Verify colors look good on small screens
|
|
382
|
+
|
|
383
|
+
## Accessibility Considerations
|
|
384
|
+
|
|
385
|
+
When customizing colors, ensure:
|
|
386
|
+
|
|
387
|
+
- **WCAG AA compliance:** Text contrast ratio of at least 4.5:1
|
|
388
|
+
- **WCAG AAA compliance:** Text contrast ratio of at least 7:1 (recommended)
|
|
389
|
+
|
|
390
|
+
Use tools like [Contrast Checker](https://webaim.org/resources/contrastchecker/) to verify your colors.
|
|
391
|
+
|
|
392
|
+
Example accessible combination:
|
|
393
|
+
- Light background: `#FFFFFF`
|
|
394
|
+
- Dark text: `#1A1A1A` (contrast ratio: 21:1)
|
|
395
|
+
- Accent: `#0066CC` (meets WCAG AAA)
|