Skip to content

Commit 891a5b6

Browse files
committed
docs: add brand color customization examples with light/dark mode
- Document BrandColorValue type usage in README files - Add examples with generic Tailwind CSS colors - Include CSS variable reference in TOKEN_USAGE.md
1 parent 20c8512 commit 891a5b6

File tree

3 files changed

+130
-0
lines changed

3 files changed

+130
-0
lines changed

README.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,50 @@ function MyApp() {
306306
- `defaultTheme` - Initial theme ('light' or 'dark'), default: 'light'
307307
- `storageKey` - LocalStorage key for persistence, default: 'ainativekit-theme'
308308
- `enableSystemTheme` - Detect system preference, default: true
309+
- `brandColors` - Custom brand color overrides (see Brand Color Customization below)
310+
311+
### Brand Color Customization
312+
313+
Override default brand colors to match your app's identity. Brand colors support both simple strings and light/dark mode variants:
314+
315+
```tsx
316+
import { ThemeProvider } from '@ainativekit/ui';
317+
318+
function App() {
319+
return (
320+
<ThemeProvider
321+
defaultTheme="light"
322+
brandColors={{
323+
// Simple: Same color for both light and dark modes
324+
primary: '#6366F1', // Indigo
325+
326+
// Light/dark variants: Different colors per mode
327+
success: { light: '#059669', dark: '#34D399' },
328+
warning: { light: '#D97706', dark: '#FBBF24' },
329+
error: { light: '#DC2626', dark: '#F87171' },
330+
}}
331+
>
332+
<MyApp />
333+
</ThemeProvider>
334+
);
335+
}
336+
```
337+
338+
**Brand Color Options:**
339+
340+
| Color | Purpose |
341+
| --------- | ------------------------------------------ |
342+
| `primary` | Main actions, links, primary buttons |
343+
| `success` | Positive states, confirmations |
344+
| `warning` | Caution messages, warnings |
345+
| `error` | Error states, destructive actions |
346+
347+
**Color Value Formats:**
348+
349+
- **String** (e.g., `'#6366F1'`): Same color for both light and dark modes
350+
- **Object** (e.g., `{ light: '#059669', dark: '#34D399' }`): Different colors per mode
351+
352+
The library automatically validates color contrast ratios and warns about potential accessibility issues.
309353

310354
## 📘 TypeScript Support
311355

packages/ui/README.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,50 @@ function MyApp() {
306306
- `defaultTheme` - Initial theme ('light' or 'dark'), default: 'light'
307307
- `storageKey` - LocalStorage key for persistence, default: 'ainativekit-theme'
308308
- `enableSystemTheme` - Detect system preference, default: true
309+
- `brandColors` - Custom brand color overrides (see Brand Color Customization below)
310+
311+
### Brand Color Customization
312+
313+
Override default brand colors to match your app's identity. Brand colors support both simple strings and light/dark mode variants:
314+
315+
```tsx
316+
import { ThemeProvider } from '@ainativekit/ui';
317+
318+
function App() {
319+
return (
320+
<ThemeProvider
321+
defaultTheme="light"
322+
brandColors={{
323+
// Simple: Same color for both light and dark modes
324+
primary: '#6366F1', // Indigo
325+
326+
// Light/dark variants: Different colors per mode
327+
success: { light: '#059669', dark: '#34D399' },
328+
warning: { light: '#D97706', dark: '#FBBF24' },
329+
error: { light: '#DC2626', dark: '#F87171' },
330+
}}
331+
>
332+
<MyApp />
333+
</ThemeProvider>
334+
);
335+
}
336+
```
337+
338+
**Brand Color Options:**
339+
340+
| Color | Purpose |
341+
| --------- | ------------------------------------------ |
342+
| `primary` | Main actions, links, primary buttons |
343+
| `success` | Positive states, confirmations |
344+
| `warning` | Caution messages, warnings |
345+
| `error` | Error states, destructive actions |
346+
347+
**Color Value Formats:**
348+
349+
- **String** (e.g., `'#6366F1'`): Same color for both light and dark modes
350+
- **Object** (e.g., `{ light: '#059669', dark: '#34D399' }`): Different colors per mode
351+
352+
The library automatically validates color contrast ratios and warns about potential accessibility issues.
309353

310354
## 📘 TypeScript Support
311355

packages/ui/src/tokens/TOKEN_USAGE.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,48 @@ import { colors, cssVar } from '@ainativekit/ui/tokens';
156156
'outline' | 'border-light' | 'border-default' | 'border-heavy';
157157
```
158158

159+
#### Customizing Brand Colors
160+
161+
You can override default brand colors via ThemeProvider. Brand colors support both simple strings and light/dark mode variants:
162+
163+
```tsx
164+
import { ThemeProvider } from '@ainativekit/ui';
165+
166+
function App() {
167+
return (
168+
<ThemeProvider
169+
brandColors={{
170+
// Simple: Same color for both light and dark modes
171+
primary: '#6366F1', // Indigo
172+
173+
// Light/dark variants: Different colors per mode
174+
success: { light: '#059669', dark: '#34D399' },
175+
warning: { light: '#D97706', dark: '#FBBF24' },
176+
error: { light: '#DC2626', dark: '#F87171' },
177+
}}
178+
>
179+
<MyApp />
180+
</ThemeProvider>
181+
);
182+
}
183+
```
184+
185+
**Available Brand Color Keys:**
186+
187+
| Key | CSS Variable | Purpose |
188+
| --------- | --------------------- | ---------------------------------- |
189+
| `primary` | `--ai-brand-primary` | Main actions, links |
190+
| `success` | `--ai-brand-success` | Positive states |
191+
| `warning` | `--ai-brand-warning` | Caution messages |
192+
| `error` | `--ai-brand-error` | Error states |
193+
194+
**Color Value Formats:**
195+
196+
- **String** (e.g., `'#6366F1'`): Same color for both light and dark modes
197+
- **Object** (e.g., `{ light: '#059669', dark: '#34D399' }`): Theme-aware colors
198+
199+
Custom brand colors are automatically validated for contrast ratios and accessibility.
200+
159201
### Typography
160202

161203
Apply complete typography styles with font size, line height, weight, and letter spacing.

0 commit comments

Comments
 (0)