shadcn-glass-ui 1.0.10 → 2.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/CHANGELOG.md +259 -16
- package/README.md +248 -28
- package/context7.json +58 -0
- package/dist/cli/index.cjs +470 -0
- package/dist/cli/index.cjs.map +1 -0
- package/dist/cli/index.d.ts +18 -0
- package/dist/cli/index.js +469 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/components.cjs +4 -4
- package/dist/components.d.ts +153 -22
- package/dist/components.js +2 -2
- package/dist/hooks.cjs +2 -2
- package/dist/index.cjs +872 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +0 -2390
- package/dist/index.js +844 -3
- package/dist/index.js.map +1 -1
- package/dist/r/ai-card-glass.json +5 -12
- package/dist/r/avatar-glass.json +5 -15
- package/dist/r/circular-metric-glass.json +5 -11
- package/dist/r/circular-progress-glass.json +5 -12
- package/dist/r/combobox-glass.json +5 -13
- package/dist/r/flag-alert-glass.json +5 -11
- package/dist/r/flags-section-glass.json +5 -12
- package/dist/r/insight-card-glass.json +17 -0
- package/dist/r/interactive-card.json +5 -12
- package/dist/r/language-bar-glass.json +5 -11
- package/dist/r/metric-card-glass.json +6 -13
- package/dist/r/metrics-grid-glass.json +5 -11
- package/dist/r/modal-glass.json +5 -15
- package/dist/r/popover-glass.json +1 -1
- package/dist/r/progress-glass.json +5 -13
- package/dist/r/registry.json +20 -2
- package/dist/r/segmented-control-glass.json +5 -11
- package/dist/r/sparkline-glass.json +17 -0
- package/dist/r/stepper-glass.json +33 -0
- package/dist/r/tabs-glass.json +4 -9
- package/dist/r/trust-score-card-glass.json +5 -12
- package/dist/r/year-card-glass.json +5 -13
- package/dist/shadcn-glass-ui.css +1 -1
- package/dist/{theme-context-XtasSxRT.cjs → theme-context-CVW50BKW.cjs} +2 -2
- package/dist/{theme-context-XtasSxRT.cjs.map → theme-context-CVW50BKW.cjs.map} +1 -1
- package/dist/themes.cjs +1 -1
- package/dist/trust-score-card-glass-BcZbul0P.js +26895 -0
- package/dist/trust-score-card-glass-BcZbul0P.js.map +1 -0
- package/dist/trust-score-card-glass-r3qM09Jp.cjs +27689 -0
- package/dist/trust-score-card-glass-r3qM09Jp.cjs.map +1 -0
- package/dist/{use-focus-BbpE2qGq.cjs → use-focus-ZE8ozmZE.cjs} +2 -2
- package/dist/{use-focus-BbpE2qGq.cjs.map → use-focus-ZE8ozmZE.cjs.map} +1 -1
- package/dist/{use-wallpaper-tint-CIqtoETa.cjs → use-wallpaper-tint-BuS80tbN.cjs} +2 -2
- package/dist/{use-wallpaper-tint-CIqtoETa.cjs.map → use-wallpaper-tint-BuS80tbN.cjs.map} +1 -1
- package/dist/{utils-CGCOTvxT.js → utils-CcyeqpKQ.js} +1 -1
- package/dist/{utils-CGCOTvxT.js.map → utils-CcyeqpKQ.js.map} +1 -1
- package/dist/{utils-CriE74ig.cjs → utils-DLXayspX.cjs} +2 -2
- package/dist/{utils-CriE74ig.cjs.map → utils-DLXayspX.cjs.map} +1 -1
- package/dist/utils.cjs +1 -1
- package/dist/utils.js +1 -1
- package/docs/AI_IMPROVEMENTS_COMPLETE.md +574 -0
- package/docs/AI_USAGE.md +1328 -0
- package/docs/API_PATTERNS_COMPARISON.md +418 -0
- package/docs/BEST_PRACTICES.md +800 -0
- package/docs/COMPLIANCE_CHECKLIST.md +307 -0
- package/docs/COMPLIANCE_TESTING.md +436 -0
- package/docs/COMPONENTS_CATALOG.md +1076 -0
- package/docs/CSS_VARIABLES_AUDIT.md +306 -0
- package/docs/CSS_VARIABLES_REFACTORING_PLAN.md +330 -0
- package/docs/EXPORTS_MAP.json +875 -0
- package/docs/EXPORTS_STRUCTURE.md +729 -0
- package/docs/GETTING_STARTED.md +655 -0
- package/docs/METRIC_CARD_API_REDESIGN.md +354 -0
- package/docs/PRIMITIVE_MAPPING.md +404 -0
- package/docs/PUBLISHING.md +593 -0
- package/docs/REGISTRY_SUMMARY.md +96 -0
- package/docs/REGISTRY_USAGE.md +339 -0
- package/docs/SECURITY.md +117 -0
- package/docs/THEME_CREATION_GUIDE.md +455 -0
- package/docs/TOKEN_ARCHITECTURE.md +365 -0
- package/docs/announcements/v1.0.5-devto.md +363 -0
- package/docs/announcements/v1.0.5-reddit.md +115 -0
- package/docs/announcements/v1.0.5-twitter.md +70 -0
- package/docs/api/README.md +725 -0
- package/docs/api/functions/ThemeProvider.md +21 -0
- package/docs/api/functions/cn.md +27 -0
- package/docs/api/functions/getNextTheme.md +21 -0
- package/docs/api/functions/getThemeConfig.md +21 -0
- package/docs/api/functions/useFocus.md +53 -0
- package/docs/api/functions/useHover.md +47 -0
- package/docs/api/functions/useResponsive.md +31 -0
- package/docs/api/functions/useTheme.md +15 -0
- package/docs/api/functions/useWallpaperTint.md +36 -0
- package/docs/api/globals.md +139 -0
- package/docs/api/interfaces/AlertGlassProps.md +131 -0
- package/docs/api/interfaces/AvatarGlassProps.md +114 -0
- package/docs/api/interfaces/BadgeGlassProps.md +118 -0
- package/docs/api/interfaces/ButtonGlassProps.md +179 -0
- package/docs/api/interfaces/CheckboxGlassProps.md +125 -0
- package/docs/api/interfaces/DropdownGlassProps.md +123 -0
- package/docs/api/interfaces/DropdownItem.md +53 -0
- package/docs/api/interfaces/GlassCardProps.md +151 -0
- package/docs/api/interfaces/InputGlassProps.md +169 -0
- package/docs/api/interfaces/NotificationGlassProps.md +67 -0
- package/docs/api/interfaces/ProgressGlassProps.md +49 -0
- package/docs/api/interfaces/SkeletonGlassProps.md +41 -0
- package/docs/api/interfaces/SliderGlassProps.md +107 -0
- package/docs/api/interfaces/TabItem.md +25 -0
- package/docs/api/interfaces/ThemeConfig.md +25 -0
- package/docs/api/interfaces/ThemeContextValue.md +47 -0
- package/docs/api/interfaces/ToggleGlassProps.md +59 -0
- package/docs/api/interfaces/TooltipGlassProps.md +119 -0
- package/docs/api/type-aliases/AlertType.md +11 -0
- package/docs/api/type-aliases/AlertVariant.md +11 -0
- package/docs/api/type-aliases/AvatarSize.md +11 -0
- package/docs/api/type-aliases/AvatarStatus.md +13 -0
- package/docs/api/type-aliases/BadgeSize.md +11 -0
- package/docs/api/type-aliases/BadgeVariant.md +11 -0
- package/docs/api/type-aliases/ButtonGlassSize.md +11 -0
- package/docs/api/type-aliases/ButtonGlassVariant.md +11 -0
- package/docs/api/type-aliases/DropdownAlign.md +11 -0
- package/docs/api/type-aliases/GlowType.md +11 -0
- package/docs/api/type-aliases/InputGlassSize.md +11 -0
- package/docs/api/type-aliases/IntensityType.md +11 -0
- package/docs/api/type-aliases/ModalSize.md +11 -0
- package/docs/api/type-aliases/NotificationType.md +11 -0
- package/docs/api/type-aliases/PaddingType.md +11 -0
- package/docs/api/type-aliases/ProgressGradient.md +11 -0
- package/docs/api/type-aliases/ProgressSize.md +11 -0
- package/docs/api/type-aliases/SkeletonVariant.md +11 -0
- package/docs/api/type-aliases/Theme.md +11 -0
- package/docs/api/type-aliases/ToggleGlassSize.md +11 -0
- package/docs/api/type-aliases/TooltipPosition.md +11 -0
- package/docs/api/variables/AICardGlass.md +11 -0
- package/docs/api/variables/AlertGlass.md +11 -0
- package/docs/api/variables/AvatarGlass.md +11 -0
- package/docs/api/variables/BadgeGlass.md +11 -0
- package/docs/api/variables/BaseProgressGlass.md +11 -0
- package/docs/api/variables/ButtonGlass.md +11 -0
- package/docs/api/variables/CareerStatsGlass.md +11 -0
- package/docs/api/variables/CareerStatsHeaderGlass.md +11 -0
- package/docs/api/variables/CheckboxGlass.md +11 -0
- package/docs/api/variables/CircularMetricGlass.md +22 -0
- package/docs/api/variables/CircularProgressGlass.md +11 -0
- package/docs/api/variables/ComboBoxGlass.md +27 -0
- package/docs/api/variables/ContributionMetricsGlass.md +11 -0
- package/docs/api/variables/DropdownGlass.md +11 -0
- package/docs/api/variables/ExpandableHeaderGlass.md +11 -0
- package/docs/api/variables/FlagAlertGlass.md +11 -0
- package/docs/api/variables/FlagsSectionGlass.md +11 -0
- package/docs/api/variables/FormFieldWrapper.md +44 -0
- package/docs/api/variables/GlassCard.md +11 -0
- package/docs/api/variables/HeaderBrandingGlass.md +11 -0
- package/docs/api/variables/HeaderNavGlass.md +11 -0
- package/docs/api/variables/IconButtonGlass.md +11 -0
- package/docs/api/variables/InputGlass.md +11 -0
- package/docs/api/variables/InteractiveCard.md +45 -0
- package/docs/api/variables/LanguageBarGlass.md +11 -0
- package/docs/api/variables/MetricCardGlass.md +11 -0
- package/docs/api/variables/MetricsGridGlass.md +11 -0
- package/docs/api/variables/ModalGlass.md +72 -0
- package/docs/api/variables/NotificationGlass.md +11 -0
- package/docs/api/variables/PopoverGlass.md +11 -0
- package/docs/api/variables/ProfileAvatarGlass.md +11 -0
- package/docs/api/variables/ProfileHeaderGlass.md +11 -0
- package/docs/api/variables/ProgressGlass.md +11 -0
- package/docs/api/variables/ProjectsListGlass.md +11 -0
- package/docs/api/variables/RainbowProgressGlass.md +11 -0
- package/docs/api/variables/RepositoryCardGlass.md +11 -0
- package/docs/api/variables/RepositoryHeaderGlass.md +11 -0
- package/docs/api/variables/RepositoryMetadataGlass.md +11 -0
- package/docs/api/variables/SearchBoxGlass.md +11 -0
- package/docs/api/variables/SegmentedControlGlass.md +11 -0
- package/docs/api/variables/SkeletonGlass.md +11 -0
- package/docs/api/variables/SliderGlass.md +11 -0
- package/docs/api/variables/SortDropdownGlass.md +11 -0
- package/docs/api/variables/StatItemGlass.md +11 -0
- package/docs/api/variables/StatusIndicatorGlass.md +11 -0
- package/docs/api/variables/THEMES.md +11 -0
- package/docs/api/variables/THEME_CONFIG.md +11 -0
- package/docs/api/variables/TabsGlass.md +52 -0
- package/docs/api/variables/ThemeToggleGlass.md +11 -0
- package/docs/api/variables/ToggleGlass.md +11 -0
- package/docs/api/variables/TooltipGlass.md +11 -0
- package/docs/api/variables/TouchTarget.md +35 -0
- package/docs/api/variables/TrustScoreCardGlass.md +11 -0
- package/docs/api/variables/TrustScoreDisplayGlass.md +11 -0
- package/docs/api/variables/UserInfoGlass.md +11 -0
- package/docs/api/variables/UserStatsLineGlass.md +11 -0
- package/docs/api/variables/YearCardGlass.md +11 -0
- package/docs/api/variables/alertVariants.md +21 -0
- package/docs/api/variables/avatarSizes.md +21 -0
- package/docs/api/variables/badgeVariants.md +21 -0
- package/docs/api/variables/buttonGlassVariants.md +21 -0
- package/docs/api/variables/cardIntensity.md +21 -0
- package/docs/api/variables/dropdownAlign.md +21 -0
- package/docs/api/variables/inputVariants.md +21 -0
- package/docs/api/variables/modalSizes.md +21 -0
- package/docs/api/variables/notificationVariants.md +21 -0
- package/docs/api/variables/progressSizes.md +21 -0
- package/docs/api/variables/shadcnAlertVariants.md +21 -0
- package/docs/api/variables/shadcnBadgeVariants.md +21 -0
- package/docs/api/variables/shadcnButtonVariants.md +21 -0
- package/docs/api/variables/skeletonVariants.md +21 -0
- package/docs/api/variables/statusSizes.md +21 -0
- package/docs/api/variables/toggleSizes.md +21 -0
- package/docs/api/variables/tooltipPositions.md +21 -0
- package/docs/design-system/UI_DESIGN.md +628 -0
- package/docs/migration/CSS_VARIABLES_MIGRATION_2.0.md +325 -0
- package/docs/migration/modal-glass-compound-api.md +458 -0
- package/docs/migration/select-to-combobox.md +386 -0
- package/docs/migration/tabs-glass-compound-api.md +579 -0
- package/docs/technical/DEPENDENCIES.md +291 -0
- package/docs/visual-testing-guide.md +324 -0
- package/package.json +16 -3
- package/dist/trust-score-card-glass-CNcQveNY.cjs +0 -8231
- package/dist/trust-score-card-glass-CNcQveNY.cjs.map +0 -1
- package/dist/trust-score-card-glass-CowcDyxH.js +0 -7795
- package/dist/trust-score-card-glass-CowcDyxH.js.map +0 -1
|
@@ -0,0 +1,455 @@
|
|
|
1
|
+
# Theme Creation Guide
|
|
2
|
+
|
|
3
|
+
## Create a New Theme in 15 Minutes
|
|
4
|
+
|
|
5
|
+
This guide shows how to create a **production-ready theme** using the 3-layer token architecture.
|
|
6
|
+
|
|
7
|
+
**Before the refactor:** Creating a theme took 2-3 hours (500+ lines of hardcoded OKLCH values).
|
|
8
|
+
|
|
9
|
+
**After the refactor:** Creating a theme takes **10-15 minutes** (~50 lines of semantic mappings).
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Quick Start: Neon Theme Example
|
|
14
|
+
|
|
15
|
+
Let's create a vibrant **neon theme** with cyan accents and dark backgrounds.
|
|
16
|
+
|
|
17
|
+
### Step 1: Create Theme File
|
|
18
|
+
|
|
19
|
+
Create `src/styles/themes/neon.css`:
|
|
20
|
+
|
|
21
|
+
```css
|
|
22
|
+
/* ========================================
|
|
23
|
+
NEON THEME
|
|
24
|
+
Vibrant cyan accents on deep black backgrounds
|
|
25
|
+
======================================== */
|
|
26
|
+
|
|
27
|
+
[data-theme='neon'] {
|
|
28
|
+
/* ========================================
|
|
29
|
+
SEMANTIC COLOR TOKENS (Layer 2)
|
|
30
|
+
Map primitive tokens to semantic roles
|
|
31
|
+
======================================== */
|
|
32
|
+
|
|
33
|
+
/* Primary Accent (Cyan) */
|
|
34
|
+
--semantic-primary: var(--oklch-cyan-400);
|
|
35
|
+
--semantic-primary-hover: var(--oklch-cyan-300);
|
|
36
|
+
--semantic-primary-muted: var(--oklch-cyan-400-40);
|
|
37
|
+
--semantic-primary-subtle: var(--oklch-cyan-400-20);
|
|
38
|
+
--semantic-primary-text: var(--oklch-cyan-300);
|
|
39
|
+
|
|
40
|
+
/* Secondary Accent (Pink) */
|
|
41
|
+
--semantic-secondary: var(--oklch-pink-500);
|
|
42
|
+
--semantic-secondary-muted: var(--oklch-pink-500-20);
|
|
43
|
+
|
|
44
|
+
/* Surface Colors (Deep Black) */
|
|
45
|
+
--semantic-surface: var(--oklch-black-90);
|
|
46
|
+
--semantic-surface-muted: var(--oklch-black-80);
|
|
47
|
+
--semantic-surface-elevated: var(--oklch-black-95);
|
|
48
|
+
--semantic-surface-overlay: var(--oklch-black-85);
|
|
49
|
+
--semantic-surface-strong: var(--oklch-white-5);
|
|
50
|
+
|
|
51
|
+
/* Border Colors */
|
|
52
|
+
--semantic-border: var(--oklch-cyan-400-40);
|
|
53
|
+
--semantic-border-muted: var(--oklch-white-10);
|
|
54
|
+
--semantic-border-strong: var(--oklch-cyan-400-60);
|
|
55
|
+
--semantic-border-subtle: var(--oklch-white-5);
|
|
56
|
+
|
|
57
|
+
/* Text Colors */
|
|
58
|
+
--semantic-text: var(--oklch-white-95);
|
|
59
|
+
--semantic-text-muted: var(--oklch-white-60);
|
|
60
|
+
--semantic-text-subtle: var(--oklch-white-50);
|
|
61
|
+
--semantic-text-disabled: var(--oklch-white-30);
|
|
62
|
+
--semantic-text-inverse: var(--oklch-black);
|
|
63
|
+
|
|
64
|
+
/* Status Colors */
|
|
65
|
+
--semantic-success: var(--oklch-emerald-400);
|
|
66
|
+
--semantic-success-muted: var(--oklch-emerald-400-20);
|
|
67
|
+
--semantic-success-subtle: var(--oklch-emerald-400-10);
|
|
68
|
+
--semantic-success-text: var(--oklch-emerald-300);
|
|
69
|
+
|
|
70
|
+
--semantic-warning: var(--oklch-amber-400);
|
|
71
|
+
--semantic-warning-muted: var(--oklch-amber-400-20);
|
|
72
|
+
--semantic-warning-subtle: var(--oklch-amber-400-10);
|
|
73
|
+
--semantic-warning-text: var(--oklch-amber-300);
|
|
74
|
+
|
|
75
|
+
--semantic-error: var(--oklch-rose-400);
|
|
76
|
+
--semantic-error-muted: var(--oklch-rose-400-20);
|
|
77
|
+
--semantic-error-subtle: var(--oklch-rose-400-10);
|
|
78
|
+
--semantic-error-text: var(--oklch-rose-300);
|
|
79
|
+
|
|
80
|
+
--semantic-info: var(--oklch-blue-400);
|
|
81
|
+
--semantic-info-muted: var(--oklch-blue-400-20);
|
|
82
|
+
--semantic-info-subtle: var(--oklch-blue-400-10);
|
|
83
|
+
--semantic-info-text: var(--oklch-blue-300);
|
|
84
|
+
|
|
85
|
+
/* Glass-specific Effects */
|
|
86
|
+
--semantic-glass-bg: var(--oklch-black-80);
|
|
87
|
+
--semantic-glass-bg-subtle: var(--oklch-black-70);
|
|
88
|
+
--semantic-glass-bg-medium: var(--oklch-black-90);
|
|
89
|
+
--semantic-glass-bg-strong: var(--oklch-black-95);
|
|
90
|
+
|
|
91
|
+
/* ========================================
|
|
92
|
+
COMPONENT OVERRIDES (Optional)
|
|
93
|
+
Override specific component tokens if needed
|
|
94
|
+
======================================== */
|
|
95
|
+
|
|
96
|
+
/* Neon glow effects */
|
|
97
|
+
--glow-primary: 0 0 30px var(--oklch-cyan-400-60), 0 0 60px var(--oklch-cyan-400-30);
|
|
98
|
+
--glow-secondary: 0 0 20px var(--oklch-pink-500-50);
|
|
99
|
+
--glow-success: 0 0 20px var(--oklch-emerald-400-50);
|
|
100
|
+
|
|
101
|
+
/* Card hover effects */
|
|
102
|
+
--card-hover-glow: 0 0 40px var(--oklch-cyan-400-40), inset 0 0 20px var(--oklch-cyan-400-10);
|
|
103
|
+
|
|
104
|
+
/* Button primary with neon gradient */
|
|
105
|
+
--btn-primary-bg: linear-gradient(135deg, var(--semantic-primary), var(--semantic-secondary));
|
|
106
|
+
--btn-primary-glow: 0 0 40px var(--oklch-cyan-400-60), 0 0 80px var(--oklch-cyan-400-30);
|
|
107
|
+
|
|
108
|
+
/* Background gradient */
|
|
109
|
+
--bg-from: var(--oklch-black);
|
|
110
|
+
--bg-via: var(--oklch-cyan-900);
|
|
111
|
+
--bg-to: var(--oklch-black);
|
|
112
|
+
--grid-color: var(--oklch-cyan-400-20);
|
|
113
|
+
--grid-opacity: 0.05;
|
|
114
|
+
}
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
**That's it!** All component tokens (buttons, badges, inputs, cards, etc.) **automatically inherit**
|
|
118
|
+
from semantic tokens.
|
|
119
|
+
|
|
120
|
+
### Step 2: Import Theme
|
|
121
|
+
|
|
122
|
+
Add to `src/glass-theme.css`:
|
|
123
|
+
|
|
124
|
+
```css
|
|
125
|
+
@import './styles/themes/neon.css';
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### Step 3: Add Theme to Type Definitions
|
|
129
|
+
|
|
130
|
+
Update `src/lib/theme-context.tsx`:
|
|
131
|
+
|
|
132
|
+
```tsx
|
|
133
|
+
export type Theme = 'glass' | 'light' | 'aurora' | 'neon';
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### Step 4: Test Theme
|
|
137
|
+
|
|
138
|
+
```tsx
|
|
139
|
+
import { ThemeProvider } from '@/lib/theme-context';
|
|
140
|
+
|
|
141
|
+
function App() {
|
|
142
|
+
return (
|
|
143
|
+
<ThemeProvider defaultTheme="neon">
|
|
144
|
+
<YourComponents />
|
|
145
|
+
</ThemeProvider>
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## Detailed Breakdown
|
|
153
|
+
|
|
154
|
+
### Semantic Tokens You Must Define
|
|
155
|
+
|
|
156
|
+
**Required (15 tokens minimum):**
|
|
157
|
+
|
|
158
|
+
| Token | Purpose | Example |
|
|
159
|
+
| ----------------------------- | -------------------------- | ---------------------- |
|
|
160
|
+
| `--semantic-primary` | Main accent color | cyan-400, violet-600 |
|
|
161
|
+
| `--semantic-secondary` | Secondary accent | pink-500, violet-500 |
|
|
162
|
+
| `--semantic-surface` | Card backgrounds | black-90, slate-100-80 |
|
|
163
|
+
| `--semantic-border` | Standard borders | cyan-400-40, slate-200 |
|
|
164
|
+
| `--semantic-text` | Primary text | white-95, slate-800 |
|
|
165
|
+
| `--semantic-text-inverse` | Inverse text (on primary) | black, white |
|
|
166
|
+
| `--semantic-success` | Success states | emerald-400 |
|
|
167
|
+
| `--semantic-warning` | Warning states | amber-400 |
|
|
168
|
+
| `--semantic-error` | Error states | rose-400 |
|
|
169
|
+
| `--semantic-info` | Info states | blue-400 |
|
|
170
|
+
| `--semantic-glass-bg` | Glass surface | black-80, white-60 |
|
|
171
|
+
| `--semantic-border-muted` | Subtle borders | white-10, slate-200-40 |
|
|
172
|
+
| `--semantic-text-muted` | Muted text | white-60, slate-500 |
|
|
173
|
+
| `--semantic-surface-elevated` | Elevated surfaces (modals) | black-95, white |
|
|
174
|
+
| `--semantic-primary-text` | Text on primary bg | cyan-300, violet-700 |
|
|
175
|
+
|
|
176
|
+
**Optional (20+ tokens for full customization):**
|
|
177
|
+
|
|
178
|
+
- Hover states: `--semantic-primary-hover`
|
|
179
|
+
- Disabled states: `--semantic-text-disabled`
|
|
180
|
+
- Alpha variants: `--semantic-primary-muted`, `--semantic-primary-subtle`
|
|
181
|
+
- Glass variants: `--semantic-glass-bg-subtle`, `--semantic-glass-bg-strong`
|
|
182
|
+
- Border variants: `--semantic-border-strong`, `--semantic-border-subtle`
|
|
183
|
+
|
|
184
|
+
### Component Token Overrides
|
|
185
|
+
|
|
186
|
+
**You don't need to define any component tokens!** They inherit from semantic tokens.
|
|
187
|
+
|
|
188
|
+
**BUT**, you can override specific components for custom effects:
|
|
189
|
+
|
|
190
|
+
```css
|
|
191
|
+
/* Override button glow in neon theme */
|
|
192
|
+
--btn-primary-glow: 0 0 40px var(--oklch-cyan-400-60);
|
|
193
|
+
|
|
194
|
+
/* Override card hover in neon theme */
|
|
195
|
+
--card-hover-glow: 0 0 40px var(--oklch-cyan-400-40);
|
|
196
|
+
|
|
197
|
+
/* Disable glows in light theme */
|
|
198
|
+
--glow-primary: none;
|
|
199
|
+
--glow-secondary: none;
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
---
|
|
203
|
+
|
|
204
|
+
## Theme Templates
|
|
205
|
+
|
|
206
|
+
### Dark Theme Template
|
|
207
|
+
|
|
208
|
+
```css
|
|
209
|
+
[data-theme='my-dark-theme'] {
|
|
210
|
+
/* Primary: Choose vibrant accent */
|
|
211
|
+
--semantic-primary: var(--oklch-{color}-{scale});
|
|
212
|
+
--semantic-primary-text: var(--oklch-{color}-300);
|
|
213
|
+
|
|
214
|
+
/* Surface: Dark backgrounds */
|
|
215
|
+
--semantic-surface: var(--oklch-black-80);
|
|
216
|
+
--semantic-border: var(--oklch-white-15);
|
|
217
|
+
|
|
218
|
+
/* Text: Light on dark */
|
|
219
|
+
--semantic-text: var(--oklch-white-90);
|
|
220
|
+
--semantic-text-inverse: var(--oklch-black);
|
|
221
|
+
|
|
222
|
+
/* Glass: Subtle transparency */
|
|
223
|
+
--semantic-glass-bg: var(--oklch-white-5);
|
|
224
|
+
}
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
### Light Theme Template
|
|
228
|
+
|
|
229
|
+
```css
|
|
230
|
+
[data-theme='my-light-theme'] {
|
|
231
|
+
/* Primary: Medium saturation */
|
|
232
|
+
--semantic-primary: var(--oklch-{color}-600);
|
|
233
|
+
|
|
234
|
+
/* Surface: Light backgrounds */
|
|
235
|
+
--semantic-surface: var(--oklch-slate-100-80);
|
|
236
|
+
--semantic-border: var(--oklch-slate-200);
|
|
237
|
+
|
|
238
|
+
/* Text: Dark on light */
|
|
239
|
+
--semantic-text: var(--oklch-slate-800);
|
|
240
|
+
--semantic-text-inverse: var(--oklch-white);
|
|
241
|
+
|
|
242
|
+
/* Glass: Frosted white */
|
|
243
|
+
--semantic-glass-bg: var(--oklch-white-60);
|
|
244
|
+
}
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
### Minimal Theme (15 tokens only)
|
|
248
|
+
|
|
249
|
+
```css
|
|
250
|
+
[data-theme='minimal'] {
|
|
251
|
+
--semantic-primary: var(--oklch-blue-500);
|
|
252
|
+
--semantic-secondary: var(--oklch-violet-500);
|
|
253
|
+
--semantic-surface: var(--oklch-white);
|
|
254
|
+
--semantic-border: var(--oklch-slate-200);
|
|
255
|
+
--semantic-text: var(--oklch-slate-900);
|
|
256
|
+
--semantic-text-inverse: var(--oklch-white);
|
|
257
|
+
--semantic-success: var(--oklch-emerald-400);
|
|
258
|
+
--semantic-warning: var(--oklch-amber-400);
|
|
259
|
+
--semantic-error: var(--oklch-red-500);
|
|
260
|
+
--semantic-info: var(--oklch-blue-400);
|
|
261
|
+
--semantic-glass-bg: var(--oklch-white-80);
|
|
262
|
+
--semantic-border-muted: var(--oklch-slate-200-50);
|
|
263
|
+
--semantic-text-muted: var(--oklch-slate-500);
|
|
264
|
+
--semantic-surface-elevated: var(--oklch-white);
|
|
265
|
+
--semantic-primary-text: var(--oklch-blue-700);
|
|
266
|
+
}
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
---
|
|
270
|
+
|
|
271
|
+
## Choosing Colors
|
|
272
|
+
|
|
273
|
+
### Step 1: Pick Primary Accent
|
|
274
|
+
|
|
275
|
+
Browse primitives in `src/styles/tokens/oklch-primitives.css`:
|
|
276
|
+
|
|
277
|
+
- **Violet family** (hue ~291-293): violet-300 to violet-900
|
|
278
|
+
- **Purple family** (hue ~303): purple-300 to purple-900
|
|
279
|
+
- **Blue family** (hue ~250-255): blue-300 to blue-900
|
|
280
|
+
- **Cyan family** (hue ~195): cyan-300 to cyan-900
|
|
281
|
+
- **Pink family** (hue ~350): pink-300 to pink-900
|
|
282
|
+
|
|
283
|
+
**Recommendation:** Use **-400 or -500** for vibrant accents, **-600** for professional themes.
|
|
284
|
+
|
|
285
|
+
### Step 2: Choose Surface Color
|
|
286
|
+
|
|
287
|
+
**Dark themes:**
|
|
288
|
+
|
|
289
|
+
- Very dark: `--oklch-black-90` to `--oklch-black-95`
|
|
290
|
+
- Medium dark: `--oklch-slate-900`, `--oklch-slate-800`
|
|
291
|
+
- With transparency: `--oklch-black-80`, `--oklch-slate-800-80`
|
|
292
|
+
|
|
293
|
+
**Light themes:**
|
|
294
|
+
|
|
295
|
+
- Pure white: `--oklch-white`
|
|
296
|
+
- Subtle: `--oklch-slate-50`, `--oklch-slate-100`
|
|
297
|
+
- Frosted: `--oklch-white-80`, `--oklch-slate-100-80`
|
|
298
|
+
|
|
299
|
+
### Step 3: Pick Text Color
|
|
300
|
+
|
|
301
|
+
**Dark themes:** `--oklch-white-90` to `--oklch-white-95` (near-white)
|
|
302
|
+
|
|
303
|
+
**Light themes:** `--oklch-slate-800` to `--oklch-slate-900` (near-black)
|
|
304
|
+
|
|
305
|
+
### Step 4: Status Colors (Universal)
|
|
306
|
+
|
|
307
|
+
These work across all themes:
|
|
308
|
+
|
|
309
|
+
- **Success:** `--oklch-emerald-400`
|
|
310
|
+
- **Warning:** `--oklch-amber-400`
|
|
311
|
+
- **Error:** `--oklch-rose-400` (dark) or `--oklch-red-500` (light)
|
|
312
|
+
- **Info:** `--oklch-blue-400`
|
|
313
|
+
|
|
314
|
+
---
|
|
315
|
+
|
|
316
|
+
## Testing Your Theme
|
|
317
|
+
|
|
318
|
+
### Visual Testing Checklist
|
|
319
|
+
|
|
320
|
+
```bash
|
|
321
|
+
# 1. Start Storybook
|
|
322
|
+
npm run storybook
|
|
323
|
+
|
|
324
|
+
# 2. Test components in your new theme
|
|
325
|
+
# - ComponentShowcase story
|
|
326
|
+
# - DesktopShowcase story
|
|
327
|
+
# - All individual component stories
|
|
328
|
+
|
|
329
|
+
# 3. Run visual regression tests
|
|
330
|
+
npx vitest --project=visual
|
|
331
|
+
|
|
332
|
+
# 4. Check for missing tokens
|
|
333
|
+
# Browser DevTools → Inspect element → Computed styles
|
|
334
|
+
# Look for "unset" or "initial" values
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
### Component Coverage
|
|
338
|
+
|
|
339
|
+
Test these component groups:
|
|
340
|
+
|
|
341
|
+
- **Buttons:** primary, secondary, ghost, destructive, success
|
|
342
|
+
- **Badges:** all variants (default, secondary, success, warning, destructive)
|
|
343
|
+
- **Alerts:** all variants
|
|
344
|
+
- **Inputs:** text, focus states
|
|
345
|
+
- **Cards:** hover, active states
|
|
346
|
+
- **Status:** online, offline, busy, away indicators
|
|
347
|
+
- **Modals/Dropdowns/Popovers:** overlays, shadows, glows
|
|
348
|
+
- **Notifications/Tooltips:** all severity levels
|
|
349
|
+
|
|
350
|
+
### Common Issues
|
|
351
|
+
|
|
352
|
+
**Issue:** Components appear unstyled **Cause:** Missing semantic tokens **Fix:** Add all required
|
|
353
|
+
tokens from template above
|
|
354
|
+
|
|
355
|
+
**Issue:** Wrong colors appear **Cause:** Typo in primitive token name **Fix:** Check
|
|
356
|
+
`oklch-primitives.css` for correct spelling
|
|
357
|
+
|
|
358
|
+
**Issue:** Theme doesn't activate **Cause:** Not imported in `glass-theme.css` **Fix:** Add
|
|
359
|
+
`@import './styles/themes/your-theme.css';`
|
|
360
|
+
|
|
361
|
+
**Issue:** Type error on theme name **Cause:** Type not updated **Fix:** Add theme to `Theme` type
|
|
362
|
+
in `theme-context.tsx`
|
|
363
|
+
|
|
364
|
+
---
|
|
365
|
+
|
|
366
|
+
## Advanced Customization
|
|
367
|
+
|
|
368
|
+
### Custom Component Tokens
|
|
369
|
+
|
|
370
|
+
Override specific components for unique effects:
|
|
371
|
+
|
|
372
|
+
```css
|
|
373
|
+
[data-theme='cyberpunk'] {
|
|
374
|
+
/* ... semantic tokens ... */
|
|
375
|
+
|
|
376
|
+
/* Cyberpunk-specific glows */
|
|
377
|
+
--btn-primary-glow:
|
|
378
|
+
0 0 10px var(--oklch-cyan-400), 0 0 20px var(--oklch-cyan-400-80),
|
|
379
|
+
0 0 40px var(--oklch-cyan-400-60), 0 0 80px var(--oklch-cyan-400-40);
|
|
380
|
+
|
|
381
|
+
/* Animated scanline effect */
|
|
382
|
+
--card-hover-bg: linear-gradient(
|
|
383
|
+
180deg,
|
|
384
|
+
var(--oklch-cyan-400-10) 0%,
|
|
385
|
+
transparent 50%,
|
|
386
|
+
var(--oklch-cyan-400-10) 100%
|
|
387
|
+
);
|
|
388
|
+
|
|
389
|
+
/* Neon text shadows */
|
|
390
|
+
--text-glow: 0 0 5px var(--oklch-cyan-400), 0 0 10px var(--oklch-cyan-400-60);
|
|
391
|
+
}
|
|
392
|
+
```
|
|
393
|
+
|
|
394
|
+
### Theme-Specific Animations
|
|
395
|
+
|
|
396
|
+
```css
|
|
397
|
+
[data-theme='aurora'] {
|
|
398
|
+
/* ... semantic tokens ... */
|
|
399
|
+
|
|
400
|
+
/* Aurora-specific gradient animation */
|
|
401
|
+
--bg-from: var(--oklch-slate-900);
|
|
402
|
+
--bg-via: var(--oklch-purple-700);
|
|
403
|
+
--bg-to: var(--oklch-slate-900);
|
|
404
|
+
|
|
405
|
+
/* Animated gradient (requires animation keyframes) */
|
|
406
|
+
--aurora-gradient: linear-gradient(
|
|
407
|
+
135deg,
|
|
408
|
+
var(--oklch-violet-500-20) 0%,
|
|
409
|
+
var(--oklch-purple-500-20) 50%,
|
|
410
|
+
var(--oklch-cyan-500-20) 100%
|
|
411
|
+
);
|
|
412
|
+
}
|
|
413
|
+
```
|
|
414
|
+
|
|
415
|
+
---
|
|
416
|
+
|
|
417
|
+
## Performance Considerations
|
|
418
|
+
|
|
419
|
+
**CSS Custom Properties** have minimal performance impact:
|
|
420
|
+
|
|
421
|
+
- **Build time:** No change (CSS variables resolved at runtime)
|
|
422
|
+
- **Runtime:** ~0.1ms overhead per property lookup
|
|
423
|
+
- **Memory:** ~1KB per theme definition
|
|
424
|
+
|
|
425
|
+
**Optimization tip:** Use semantic tokens, not primitive tokens directly, to reduce cascade depth.
|
|
426
|
+
|
|
427
|
+
---
|
|
428
|
+
|
|
429
|
+
## Examples
|
|
430
|
+
|
|
431
|
+
See existing themes for reference:
|
|
432
|
+
|
|
433
|
+
- **Glass Theme:** `src/styles/themes/glass.css` (dark glassmorphism)
|
|
434
|
+
- **Light Theme:** `src/styles/themes/light.css` (light mode)
|
|
435
|
+
- **Aurora Theme:** `src/styles/themes/aurora.css` (gradient dark)
|
|
436
|
+
|
|
437
|
+
---
|
|
438
|
+
|
|
439
|
+
## Summary: 15-Minute Checklist
|
|
440
|
+
|
|
441
|
+
- [ ] Create `src/styles/themes/your-theme.css`
|
|
442
|
+
- [ ] Define 15 required semantic tokens
|
|
443
|
+
- [ ] Add optional tokens for custom effects
|
|
444
|
+
- [ ] Import in `src/glass-theme.css`
|
|
445
|
+
- [ ] Update `Theme` type in `theme-context.tsx`
|
|
446
|
+
- [ ] Test in Storybook (ComponentShowcase, DesktopShowcase)
|
|
447
|
+
- [ ] Run visual regression tests
|
|
448
|
+
- [ ] Check all component variants
|
|
449
|
+
- [ ] Document theme in README (optional)
|
|
450
|
+
|
|
451
|
+
**Total time:** 10-15 minutes ⏱️
|
|
452
|
+
|
|
453
|
+
**Lines of code:** ~50 (vs. 500+ before refactoring)
|
|
454
|
+
|
|
455
|
+
**Maintenance:** Change 1 token, update entire theme instantly
|