@asafarim/react-themes 1.6.1 โ†’ 1.8.0-canary.2f6ab36.2

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 CHANGED
@@ -1,685 +1,685 @@
1
- # @asafarim/react-themes
2
-
3
- A comprehensive theme management system for React applications with automatic dark/light mode detection, custom theme creation, and smooth transitions.
4
-
5
- ![npm version](https://img.shields.io/npm/v/@asafarim/react-themes)
6
- ![license](https://img.shields.io/npm/l/@asafarim/react-themes)
7
- ![typescript](https://img.shields.io/badge/TypeScript-Ready-blue)
8
-
9
- ## ๐Ÿ“ธ Preview
10
-
11
- Experience the theme system in action with our **[Live Interactive Demo](https://alisafari-it.github.io/react-themes/)**
12
-
13
- ### ๐ŸŽฏ Demo Showcases
14
-
15
- The live demo demonstrates all package capabilities:
16
-
17
- - **๐ŸŽจ Theme Switching**: Real-time theme transitions between light, dark, and auto modes
18
- - **๐Ÿ”ง Component Gallery**: All built-in components (ThemeToggle, ThemeSelector) in action
19
- - **๐Ÿ“ฑ Responsive Design**: How themes adapt across different screen sizes
20
- - **๐ŸŽช CSS Variables**: Live CSS variable updates and their effects
21
- - **โšก Performance**: Smooth animations and transitions
22
- - **โ™ฟ Accessibility**: Keyboard navigation and screen reader support
23
-
24
- <table>
25
- <tr>
26
- <td align="center">
27
- <img src="./src/react-themes-light.png" alt="Light Theme Preview" width="400"/>
28
- <br/>
29
- <em>Light Theme - Clean and Modern</em>
30
- </td>
31
- <td align="center">
32
- <img src="./src/react-themes-dark.png" alt="Dark Theme Preview" width="400"/>
33
- <br/>
34
- <em>Dark Theme - Elegant and Eye-friendly</em>
35
- </td>
36
- </tr>
37
- </table>
38
-
39
- ### ๐Ÿš€ Try It Live
40
-
41
- Visit **[alisafari-it.github.io/react-themes](https://alisafari-it.github.io/react-themes)** to:
42
-
43
- 1. **Interactive Testing**: Toggle between themes and see instant changes
44
- 2. **Code Examples**: View implementation examples for each feature
45
- 3. **Performance Metrics**: See how fast theme switching works
46
- 4. **Integration Examples**: Real-world usage with other components
47
- 5. **Customization Demo**: Examples of custom theme creation
48
- 6. **Browser Compatibility**: Test across different browsers and devices
49
-
50
- ## โœจ Features
51
-
52
- ### ๐ŸŒ“ **Smart Theme Management**
53
-
54
- - **Auto Detection**: Automatically detects and follows system dark/light mode preferences
55
- - **Manual Override**: Users can manually select their preferred theme mode
56
- - **Persistence**: Remembers user choice across browser sessions using localStorage
57
- - **Real-time Updates**: Instantly responds to system theme changes
58
-
59
- ### ๐ŸŽจ **Advanced Theming System**
60
-
61
- - **Built-in Themes**: Professionally designed light and dark themes out of the box
62
- - **Custom Themes**: Create unlimited custom themes with full control over colors, spacing, and typography
63
- - **Theme Merging**: Easily extend existing themes with custom properties
64
- - **CSS Variables**: Automatic injection of CSS custom properties for seamless styling
65
-
66
- ### โšก **Performance & User Experience**
67
-
68
- - **Smooth Transitions**: Beautiful, configurable transitions between theme changes
69
- - **Zero Flicker**: Prevents flash of unstyled content during theme initialization
70
- - **Lightweight**: Minimal bundle size impact (~8KB gzipped)
71
- - **Tree Shakeable**: Import only what you need
72
-
73
- ### ๐Ÿ”ง **Developer Experience**
74
-
75
- - **TypeScript First**: Full TypeScript support with comprehensive type definitions
76
- - **React 18+ Ready**: Optimized for latest React features including concurrent rendering
77
- - **Hooks API**: Intuitive React hooks for theme management
78
- - **Component Library**: Pre-built, accessible components for common use cases
79
-
80
- ### ๐ŸŽฏ **Integration & Compatibility**
81
-
82
- - **Framework Agnostic**: Works with any React-based framework (Next.js, Gatsby, CRA, Vite)
83
- - **CSS-in-JS Compatible**: Works with styled-components, emotion, and other CSS-in-JS libraries
84
- - **Tailwind Ready**: Seamlessly integrates with Tailwind CSS through CSS variables
85
- - **Server-Side Rendering**: Full SSR support with proper hydration handling
86
-
87
- ### โ™ฟ **Accessibility & Standards**
88
-
89
- - **WCAG Compliant**: Meets Web Content Accessibility Guidelines
90
- - **Keyboard Navigation**: Full keyboard support for all interactive elements
91
- - **Screen Reader Support**: Proper ARIA labels and announcements
92
- - **High Contrast**: Ensures sufficient color contrast ratios in all themes
93
- - **Reduced Motion**: Respects user's motion preferences
94
-
95
- ## ๐Ÿ“ฆ Installation
96
-
97
- ```bash
98
- npm install @asafarim/react-themes
99
- # or
100
- yarn add @asafarim/react-themes
101
- # or
102
- pnpm add @asafarim/react-themes
103
- ```
104
-
105
- ## ๐Ÿš€ Quick Start
106
-
107
- ### 1. Wrap your app with ThemeProvider
108
-
109
- ```tsx
110
- import React from 'react';
111
- import { ThemeProvider } from '@asafarim/react-themes';
112
- import '@asafarim/react-themes/styles.css'; // Optional base styles
113
-
114
- function App() {
115
- return (
116
- <ThemeProvider defaultMode="auto" persistMode={true}>
117
- <YourAppContent />
118
- </ThemeProvider>
119
- );
120
- }
121
- ```
122
-
123
- ### 2. Use the theme in your components
124
-
125
- ```tsx
126
- import React from 'react';
127
- import { useTheme, ThemeToggle } from '@asafarim/react-themes';
128
-
129
- function MyComponent() {
130
- const { mode, currentTheme, toggleMode } = useTheme();
131
-
132
- return (
133
- <div>
134
- <h1>Current mode: {mode}</h1>
135
- <ThemeToggle />
136
- {/* Your component content */}
137
- </div>
138
- );
139
- }
140
- ```
141
-
142
- ## ๐ŸŽฏ Use Cases & Examples
143
-
144
- ### ๐Ÿ“š **Real-World Applications**
145
-
146
- Our **[Live Demo](https://bibliography.asafarim.com/react-themes/demo)** showcases these practical implementations:
147
-
148
- #### ๐ŸŒ **Web Applications**
149
-
150
- ```tsx
151
- // E-commerce dashboard with theme switching
152
- import { ThemeProvider, ThemeToggle } from '@asafarim/react-themes';
153
-
154
- function EcommerceDashboard() {
155
- return (
156
- <ThemeProvider defaultMode="auto" persistMode={true}>
157
- <header className="dashboard-header">
158
- <h1>Sales Dashboard</h1>
159
- <ThemeToggle size="sm" showLabels={true} />
160
- </header>
161
- <main className="dashboard-content">
162
- {/* Dashboard content adapts automatically */}
163
- </main>
164
- </ThemeProvider>
165
- );
166
- }
167
- ```
168
-
169
- #### ๐Ÿ“ฑ **Mobile-First Design**
170
-
171
- ```css
172
- /* Responsive design that adapts to theme */
173
- .mobile-card {
174
- background: var(--theme-color-background-secondary);
175
- border: 1px solid var(--theme-color-border);
176
- padding: var(--theme-spacing-md);
177
- border-radius: var(--theme-radius-lg);
178
-
179
- /* Automatic dark mode styling */
180
- box-shadow: var(--theme-shadow-sm);
181
- transition: var(--theme-transition-normal);
182
- }
183
- ```
184
-
185
- #### ๐ŸŽจ **Design Systems**
186
-
187
- ```tsx
188
- // Integration with component libraries
189
- import { Button, Card } from 'your-ui-library';
190
- import { useTheme } from '@asafarim/react-themes';
191
-
192
- function ThemedComponents() {
193
- const { currentTheme } = useTheme();
194
-
195
- return (
196
- <Card
197
- style={{
198
- backgroundColor: currentTheme.colors.background,
199
- color: currentTheme.colors.text
200
- }}
201
- >
202
- <Button variant={currentTheme.mode === 'dark' ? 'outlined' : 'filled'}>
203
- Themed Button
204
- </Button>
205
- </Card>
206
- );
207
- }
208
- ```
209
-
210
- ### ๐Ÿ”„ **Advanced Patterns**
211
-
212
- #### ๐ŸŽช **Dynamic Theme Loading**
213
-
214
- ```tsx
215
- // Load themes dynamically based on user preferences
216
- import { createTheme, useTheme } from '@asafarim/react-themes';
217
-
218
- function DynamicThemeLoader() {
219
- const { setTheme } = useTheme();
220
-
221
- const loadUserTheme = async (userId: string) => {
222
- const userPrefs = await fetch(`/api/users/${userId}/theme`);
223
- const themeData = await userPrefs.json();
224
-
225
- const customTheme = createTheme(themeData);
226
- setTheme(customTheme);
227
- };
228
-
229
- return <div>Loading personalized theme...</div>;
230
- }
231
- ```
232
-
233
- #### ๐Ÿข **Multi-Brand Applications**
234
-
235
- ```tsx
236
- // Switch between different brand themes
237
- const brandThemes = {
238
- corporate: createTheme(lightTheme, {
239
- name: 'corporate',
240
- colors: { primary: '#0066cc', secondary: '#004499' }
241
- }),
242
- creative: createTheme(darkTheme, {
243
- name: 'creative',
244
- colors: { primary: '#ff6b6b', secondary: '#4ecdc4' }
245
- })
246
- };
247
-
248
- <ThemeProvider customThemes={brandThemes}>
249
- <BrandSwitcher />
250
- </ThemeProvider>
251
- ```
252
-
253
- ## ๐Ÿ“– API Reference
254
-
255
- ### ๐Ÿ—๏ธ ThemeProvider
256
-
257
- The foundational component that manages theme state and applies CSS variables throughout your application.
258
-
259
- ```tsx
260
- interface ThemeProviderProps {
261
- children: ReactNode;
262
- defaultMode?: 'light' | 'dark' | 'auto';
263
- defaultTheme?: string;
264
- persistMode?: boolean;
265
- storageKey?: string;
266
- customThemes?: Record<string, Theme>;
267
- config?: ThemeConfig;
268
- }
269
- ```
270
-
271
- **Essential Props:**
272
-
273
- | Prop | Type | Default | Description |
274
- |------|------|---------|-------------|
275
- | `children` | `ReactNode` | **required** | Child components to provide theme context to |
276
- | `defaultMode` | `'light' \| 'dark' \| 'auto'` | `'auto'` | Initial theme mode on first load |
277
- | `defaultTheme` | `string` | `'default'` | Name of the default theme to use |
278
- | `persistMode` | `boolean` | `true` | Whether to save user's theme choice to localStorage |
279
- | `storageKey` | `string` | `'asafarim-theme-mode'` | localStorage key for persistence |
280
- | `customThemes` | `Record<string, Theme>` | `{}` | Additional themes to make available |
281
-
282
- **Advanced Configuration:**
283
-
284
- ```tsx
285
- // Extended configuration options
286
- interface ThemeConfig {
287
- transitionDuration?: string;
288
- breakpoints?: Record<string, string>;
289
- enableSystemTheme?: boolean;
290
- cssVariablePrefix?: string;
291
- }
292
-
293
- <ThemeProvider
294
- config={{
295
- transitionDuration: '200ms',
296
- enableSystemTheme: true,
297
- cssVariablePrefix: 'app-theme'
298
- }}
299
- >
300
- <App />
301
- </ThemeProvider>
302
- ```
303
-
304
- ### ๐Ÿช useTheme Hook
305
-
306
- The primary hook for accessing and controlling theme state.
307
-
308
- ```tsx
309
- interface UseThemeReturn {
310
- currentTheme: Theme; // Currently active theme object
311
- mode: ThemeMode; // Current mode: 'light' | 'dark' | 'auto'
312
- setMode: (mode: ThemeMode) => void; // Change theme mode
313
- setTheme: (theme: Theme) => void; // Change active theme
314
- themes: Record<string, Theme>; // All available themes
315
- toggleMode: () => void; // Cycle through light โ†’ dark โ†’ auto
316
- }
317
- ```
318
-
319
- **Real-world Example:**
320
-
321
- ```tsx
322
- function ThemeAwareComponent() {
323
- const { currentTheme, mode, setMode, toggleMode } = useTheme();
324
-
325
- // Conditional styling based on theme
326
- const isDarkMode = mode === 'dark' ||
327
- (mode === 'auto' && window.matchMedia('(prefers-color-scheme: dark)').matches);
328
-
329
- return (
330
- <div style={{
331
- backgroundColor: currentTheme.colors.background,
332
- color: currentTheme.colors.text
333
- }}>
334
- <h2>Current Theme: {currentTheme.name}</h2>
335
- <p>Mode: {mode} {isDarkMode ? '๐ŸŒ™' : 'โ˜€๏ธ'}</p>
336
- <button onClick={toggleMode}>Toggle Theme</button>
337
- </div>
338
- );
339
- }
340
- ```
341
-
342
- ### โšก useThemeToggle Hook
343
-
344
- Simplified hook specifically for theme mode toggling with additional utilities.
345
-
346
- ```tsx
347
- interface UseThemeToggleReturn {
348
- mode: ThemeMode; // Current theme mode
349
- setMode: (mode: ThemeMode) => void; // Set specific mode
350
- toggleMode: () => void; // Cycle through modes
351
- isDark: boolean; // true if dark mode is active
352
- isLight: boolean; // true if light mode is active
353
- isAuto: boolean; // true if auto mode is active
354
- effectiveMode: 'light' | 'dark'; // Resolved mode (auto becomes light/dark)
355
- }
356
- ```
357
-
358
- **Practical Usage:**
359
-
360
- ```tsx
361
- function SmartThemeButton() {
362
- const { mode, toggleMode, isDark, effectiveMode } = useThemeToggle();
363
-
364
- const getIcon = () => {
365
- if (mode === 'auto') return '๐ŸŒ“';
366
- return isDark ? '๐ŸŒ™' : 'โ˜€๏ธ';
367
- };
368
-
369
- const getLabel = () => {
370
- if (mode === 'auto') return `Auto (${effectiveMode})`;
371
- return mode === 'dark' ? 'Dark Mode' : 'Light Mode';
372
- };
373
-
374
- return (
375
- <button onClick={toggleMode} title={getLabel()}>
376
- {getIcon()} {getLabel()}
377
- </button>
378
- );
379
- }
380
- ```
381
-
382
- ### Components
383
-
384
- #### ThemeToggle
385
-
386
- A pre-built theme toggle button.
387
-
388
- ```tsx
389
- <ThemeToggle
390
- size="md" // 'sm' | 'md' | 'lg'
391
- showLabels={false} // Show text labels
392
- className="custom-class"
393
- style={{ margin: '10px' }}
394
- />
395
- ```
396
-
397
- #### ThemeSelector
398
-
399
- A dropdown selector for theme modes.
400
-
401
- ```tsx
402
- <ThemeSelector
403
- showLabels={true}
404
- className="custom-class"
405
- options={[
406
- { mode: 'light', label: 'Light', icon: 'โ˜€๏ธ' },
407
- { mode: 'dark', label: 'Dark', icon: '๐ŸŒ™' },
408
- { mode: 'auto', label: 'Auto', icon: '๐ŸŒ“' }
409
- ]}
410
- />
411
- ```
412
-
413
- ## ๐ŸŽจ Custom Themes
414
-
415
- ### Creating Custom Themes
416
-
417
- ```tsx
418
- import { createTheme, lightTheme } from '@asafarim/react-themes';
419
-
420
- const myCustomTheme = createTheme(lightTheme, {
421
- name: 'my-theme',
422
- colors: {
423
- primary: '#ff6b6b',
424
- primaryHover: '#ff5252',
425
- background: '#f8f9fa',
426
- text: '#212529'
427
- }
428
- });
429
-
430
- // Use with provider
431
- <ThemeProvider customThemes={{ 'my-theme': myCustomTheme }}>
432
- <App />
433
- </ThemeProvider>
434
- ```
435
-
436
- ### Using CSS Variables
437
-
438
- The package automatically injects CSS variables that you can use in your styles:
439
-
440
- ```css
441
- .my-component {
442
- background-color: var(--theme-color-background);
443
- color: var(--theme-color-text);
444
- border: 1px solid var(--theme-color-border);
445
- border-radius: var(--theme-radius-md);
446
- padding: var(--theme-spacing-md);
447
- transition: all var(--theme-transition-normal);
448
- }
449
-
450
- .my-button {
451
- background-color: var(--theme-color-primary);
452
- color: white;
453
- font-size: var(--theme-font-size-sm);
454
- }
455
-
456
- .my-button:hover {
457
- background-color: var(--theme-color-primary-hover);
458
- }
459
- ```
460
-
461
- ## ๐ŸŽฏ Integration with @asafarim/dd-menu
462
-
463
- This package works seamlessly with `@asafarim/dd-menu`:
464
-
465
- ```tsx
466
- import { DDMenu } from '@asafarim/dd-menu';
467
- import { useTheme } from '@asafarim/react-themes';
468
-
469
- function NavMenu() {
470
- const { mode } = useTheme();
471
-
472
- return (
473
- <DDMenu
474
- items={menuItems}
475
- theme={mode} // Pass current theme mode
476
- variant="navbar"
477
- />
478
- );
479
- }
480
- ```
481
-
482
- ## ๐Ÿš€ Live Demo & Showcase
483
-
484
- ### ๐ŸŽญ **Interactive Demo**
485
-
486
- Experience all features at **[bibliography.asafarim.com/react-themes/demo](https://bibliography.asafarim.com/react-themes/demo)**
487
-
488
- The demo is a comprehensive showcase featuring:
489
-
490
- #### ๐ŸŽจ **Theme Gallery**
491
-
492
- - **Light Theme**: Clean, modern interface with excellent readability
493
- - **Dark Theme**: Elegant dark mode optimized for low-light environments
494
- - **Auto Mode**: Intelligent system preference detection with seamless switching
495
- - **Custom Themes**: Examples of brand-specific and specialized themes
496
-
497
- #### ๐Ÿ› ๏ธ **Component Showcase**
498
-
499
- - **ThemeToggle Variants**: Different sizes, styles, and label configurations
500
- - **ThemeSelector**: Dropdown with icons, labels, and custom options
501
- - **Integration Examples**: Real components using theme variables
502
- - **Performance Metrics**: Live transition timing and smoothness demos
503
-
504
- #### ๐Ÿ“Š **Technical Demonstrations**
505
-
506
- - **CSS Variables Live**: Watch variables update in real-time as themes change
507
- - **Browser Compatibility**: Cross-browser testing interface
508
- - **Accessibility Features**: Screen reader announcements and keyboard navigation
509
- - **Mobile Responsiveness**: Touch-optimized controls and layouts
510
-
511
- #### ๐Ÿ”ง **Developer Tools**
512
-
513
- - **Code Examples**: Copy-paste ready implementations
514
- - **Theme Inspector**: Live theme object visualization
515
- - **CSS Variable Explorer**: All available variables with current values
516
- - **Performance Monitor**: Bundle size and render time metrics
517
-
518
- ### ๐Ÿ“ฑ **Mobile-Optimized Experience**
519
-
520
- The demo is fully responsive and showcases:
521
-
522
- - Touch-friendly theme controls
523
- - Swipe gestures for theme switching
524
- - Adaptive layouts for different screen sizes
525
- - Battery-conscious animations
526
-
527
- ### ๐ŸŽฏ **Use Cases Demonstrated**
528
-
529
- 1. **E-commerce Interface**: Product cards, navigation, and checkout flows
530
- 2. **Dashboard Layout**: Charts, tables, and control panels
531
- 3. **Content Management**: Text editors, media galleries, and forms
532
- 4. **Social Platform**: Posts, comments, and user profiles
533
- 5. **Documentation Site**: Code blocks, navigation, and search interfaces
534
-
535
- ## ๐Ÿ”ง Advanced Usage
536
-
537
- ### Custom Theme Structure
538
-
539
- ```tsx
540
- interface Theme {
541
- name: string;
542
- mode: 'light' | 'dark' | 'auto';
543
- colors: {
544
- background: string;
545
- backgroundSecondary: string;
546
- text: string;
547
- textSecondary: string;
548
- primary: string;
549
- primaryHover: string;
550
- border: string;
551
- // ... more colors
552
- };
553
- spacing: {
554
- xs: string;
555
- sm: string;
556
- md: string;
557
- lg: string;
558
- // ... more spacing
559
- };
560
- // ... typography, radius, transitions, zIndex
561
- }
562
- ```
563
-
564
- ### Programmatic Theme Application
565
-
566
- ```tsx
567
- import { applyTheme } from '@asafarim/react-themes';
568
-
569
- // Apply theme manually
570
- applyTheme(customTheme, 'dark');
571
- ```
572
-
573
- ## ๐ŸŒ Browser Support
574
-
575
- - Modern browsers with CSS custom properties support
576
- - Chrome 49+
577
- - Firefox 31+
578
- - Safari 9.1+
579
- - Edge 16+
580
-
581
- ## ๐Ÿค Contributing
582
-
583
- We welcome contributions! The project is open source and actively maintained.
584
-
585
- ### ๐Ÿ› ๏ธ **Development Setup**
586
-
587
- ```bash
588
- git clone https://github.com/AliSafari-IT/asafarim
589
- cd ASafariM.Clients/packages/react-themes
590
- pnpm install
591
- pnpm build
592
- pnpm test
593
- ```
594
-
595
- ### ๐Ÿงช **Testing the Demo**
596
-
597
- ```bash
598
- # Run the demo locally
599
- cd ../../asafarim-bibliography
600
- pnpm install
601
- pnpm start
602
- # Visit http://localhost:3004/react-themes/demo
603
- ```
604
-
605
- ### ๐Ÿ“‹ **Contribution Guidelines**
606
-
607
- - Follow TypeScript best practices
608
- - Add tests for new features
609
- - Update documentation and examples
610
- - Ensure accessibility compliance
611
- - Test across different browsers
612
-
613
- ## ๐Ÿ“„ License
614
-
615
- MIT License - see the [LICENSE](LICENSE) file for details.
616
-
617
- ## ๐ŸŒŸ **Why Choose @asafarim/react-themes?**
618
-
619
- ### โœ… **Production Ready**
620
-
621
- - Used in production at [ASafariM Bibliography](https://bibliography.asafarim.com)
622
- - Thoroughly tested across browsers and devices
623
- - Optimized for performance and accessibility
624
- - Regular updates and maintenance
625
-
626
- ### ๐ŸŽฏ **Developer Focused**
627
-
628
- - Extensive TypeScript support
629
- - Comprehensive documentation with live examples
630
- - Active community support
631
- - Regular feature updates based on user feedback
632
-
633
- ### ๐Ÿš€ **Modern Standards**
634
-
635
- - React 18+ optimized
636
- - CSS3 custom properties
637
- - ES2020+ JavaScript features
638
- - Modern bundling and tree-shaking support
639
-
640
- ## ๐Ÿ”— Related Packages & Ecosystem
641
-
642
- - **[`@asafarim/dd-menu`](https://www.npmjs.com/package/@asafarim/dd-menu)** - Elegant dropdown menu component with theme integration
643
- - **[ASafariM Bibliography](https://bibliography.asafarim.com)** - Live application showcasing the theme system
644
- - **[Interactive Demo](https://bibliography.asafarim.com/react-themes/demo)** - Comprehensive feature demonstration
645
-
646
- ## ๏ฟฝ Project Stats
647
-
648
- - ๐Ÿ—๏ธ **Built with**: TypeScript, React 18, CSS3 Custom Properties
649
- - ๐Ÿ“ฆ **Bundle Size**: ~8KB gzipped
650
- - ๐ŸŒ **Browser Support**: Modern browsers (Chrome 49+, Firefox 31+, Safari 9.1+, Edge 16+)
651
- - โšก **Performance**: Zero-flicker theme switching, optimized re-renders
652
- - โ™ฟ **Accessibility**: WCAG 2.1 AA compliant
653
-
654
- ## ๏ฟฝ๐Ÿ“ Changelog
655
-
656
- ### ๐ŸŽ‰ **v1.1.0** - Latest
657
-
658
- - Enhanced TypeScript definitions
659
- - Improved performance and bundle size
660
- - Added comprehensive demo showcase
661
- - Extended browser compatibility
662
- - New theme customization options
663
-
664
- ### ๐Ÿš€ **v1.0.0** - Initial Release
665
-
666
- - Core theme provider functionality
667
- - Auto mode detection with system preference sync
668
- - CSS variable injection system
669
- - Built-in components (ThemeToggle, ThemeSelector)
670
- - TypeScript support with full type safety
671
- - localStorage persistence with customizable keys
672
-
673
- ---
674
-
675
- <div align="center">
676
-
677
- ### ๐ŸŒŸ **Experience the Future of React Theming**
678
-
679
- **[Try the Live Demo](https://alisafari-it.github.io/react-themes)** | **[View Documentation](https://www.npmjs.com/package/@asafarim/react-themes)** | **[See Source Code](https://github.com/AliSafari-IT/react-themes)**
680
-
681
- Made with โค๏ธ and โ˜• by **[ASafariM](https://asafarim.com)**
682
-
683
- *Empowering developers to create beautiful, accessible, and user-friendly themed applications*
684
-
685
- </div>
1
+ # @asafarim/react-themes
2
+
3
+ A comprehensive theme management system for React applications with automatic dark/light mode detection, custom theme creation, and smooth transitions.
4
+
5
+ ![npm version](https://img.shields.io/npm/v/@asafarim/react-themes)
6
+ ![license](https://img.shields.io/npm/l/@asafarim/react-themes)
7
+ ![typescript](https://img.shields.io/badge/TypeScript-Ready-blue)
8
+
9
+ ## ๐Ÿ“ธ Preview
10
+
11
+ Experience the theme system in action with our **[Live Interactive Demo](https://alisafari-it.github.io/react-themes/)**
12
+
13
+ ### ๐ŸŽฏ Demo Showcases
14
+
15
+ The live demo demonstrates all package capabilities:
16
+
17
+ - **๐ŸŽจ Theme Switching**: Real-time theme transitions between light, dark, and auto modes
18
+ - **๐Ÿ”ง Component Gallery**: All built-in components (ThemeToggle, ThemeSelector) in action
19
+ - **๐Ÿ“ฑ Responsive Design**: How themes adapt across different screen sizes
20
+ - **๐ŸŽช CSS Variables**: Live CSS variable updates and their effects
21
+ - **โšก Performance**: Smooth animations and transitions
22
+ - **โ™ฟ Accessibility**: Keyboard navigation and screen reader support
23
+
24
+ <table>
25
+ <tr>
26
+ <td align="center">
27
+ <img src="./src/react-themes-light.png" alt="Light Theme Preview" width="400"/>
28
+ <br/>
29
+ <em>Light Theme - Clean and Modern</em>
30
+ </td>
31
+ <td align="center">
32
+ <img src="./src/react-themes-dark.png" alt="Dark Theme Preview" width="400"/>
33
+ <br/>
34
+ <em>Dark Theme - Elegant and Eye-friendly</em>
35
+ </td>
36
+ </tr>
37
+ </table>
38
+
39
+ ### ๐Ÿš€ Try It Live
40
+
41
+ Visit **[alisafari-it.github.io/react-themes](https://alisafari-it.github.io/react-themes)** to:
42
+
43
+ 1. **Interactive Testing**: Toggle between themes and see instant changes
44
+ 2. **Code Examples**: View implementation examples for each feature
45
+ 3. **Performance Metrics**: See how fast theme switching works
46
+ 4. **Integration Examples**: Real-world usage with other components
47
+ 5. **Customization Demo**: Examples of custom theme creation
48
+ 6. **Browser Compatibility**: Test across different browsers and devices
49
+
50
+ ## โœจ Features
51
+
52
+ ### ๐ŸŒ“ **Smart Theme Management**
53
+
54
+ - **Auto Detection**: Automatically detects and follows system dark/light mode preferences
55
+ - **Manual Override**: Users can manually select their preferred theme mode
56
+ - **Persistence**: Remembers user choice across browser sessions using localStorage
57
+ - **Real-time Updates**: Instantly responds to system theme changes
58
+
59
+ ### ๐ŸŽจ **Advanced Theming System**
60
+
61
+ - **Built-in Themes**: Professionally designed light and dark themes out of the box
62
+ - **Custom Themes**: Create unlimited custom themes with full control over colors, spacing, and typography
63
+ - **Theme Merging**: Easily extend existing themes with custom properties
64
+ - **CSS Variables**: Automatic injection of CSS custom properties for seamless styling
65
+
66
+ ### โšก **Performance & User Experience**
67
+
68
+ - **Smooth Transitions**: Beautiful, configurable transitions between theme changes
69
+ - **Zero Flicker**: Prevents flash of unstyled content during theme initialization
70
+ - **Lightweight**: Minimal bundle size impact (~8KB gzipped)
71
+ - **Tree Shakeable**: Import only what you need
72
+
73
+ ### ๐Ÿ”ง **Developer Experience**
74
+
75
+ - **TypeScript First**: Full TypeScript support with comprehensive type definitions
76
+ - **React 18+ Ready**: Optimized for latest React features including concurrent rendering
77
+ - **Hooks API**: Intuitive React hooks for theme management
78
+ - **Component Library**: Pre-built, accessible components for common use cases
79
+
80
+ ### ๐ŸŽฏ **Integration & Compatibility**
81
+
82
+ - **Framework Agnostic**: Works with any React-based framework (Next.js, Gatsby, CRA, Vite)
83
+ - **CSS-in-JS Compatible**: Works with styled-components, emotion, and other CSS-in-JS libraries
84
+ - **Tailwind Ready**: Seamlessly integrates with Tailwind CSS through CSS variables
85
+ - **Server-Side Rendering**: Full SSR support with proper hydration handling
86
+
87
+ ### โ™ฟ **Accessibility & Standards**
88
+
89
+ - **WCAG Compliant**: Meets Web Content Accessibility Guidelines
90
+ - **Keyboard Navigation**: Full keyboard support for all interactive elements
91
+ - **Screen Reader Support**: Proper ARIA labels and announcements
92
+ - **High Contrast**: Ensures sufficient color contrast ratios in all themes
93
+ - **Reduced Motion**: Respects user's motion preferences
94
+
95
+ ## ๐Ÿ“ฆ Installation
96
+
97
+ ```bash
98
+ npm install @asafarim/react-themes
99
+ # or
100
+ yarn add @asafarim/react-themes
101
+ # or
102
+ pnpm add @asafarim/react-themes
103
+ ```
104
+
105
+ ## ๐Ÿš€ Quick Start
106
+
107
+ ### 1. Wrap your app with ThemeProvider
108
+
109
+ ```tsx
110
+ import React from 'react';
111
+ import { ThemeProvider } from '@asafarim/react-themes';
112
+ import '@asafarim/react-themes/styles.css'; // Optional base styles
113
+
114
+ function App() {
115
+ return (
116
+ <ThemeProvider defaultMode="auto" persistMode={true}>
117
+ <YourAppContent />
118
+ </ThemeProvider>
119
+ );
120
+ }
121
+ ```
122
+
123
+ ### 2. Use the theme in your components
124
+
125
+ ```tsx
126
+ import React from 'react';
127
+ import { useTheme, ThemeToggle } from '@asafarim/react-themes';
128
+
129
+ function MyComponent() {
130
+ const { mode, currentTheme, toggleMode } = useTheme();
131
+
132
+ return (
133
+ <div>
134
+ <h1>Current mode: {mode}</h1>
135
+ <ThemeToggle />
136
+ {/* Your component content */}
137
+ </div>
138
+ );
139
+ }
140
+ ```
141
+
142
+ ## ๐ŸŽฏ Use Cases & Examples
143
+
144
+ ### ๐Ÿ“š **Real-World Applications**
145
+
146
+ Our **[Live Demo](https://bibliography.asafarim.com/react-themes/demo)** showcases these practical implementations:
147
+
148
+ #### ๐ŸŒ **Web Applications**
149
+
150
+ ```tsx
151
+ // E-commerce dashboard with theme switching
152
+ import { ThemeProvider, ThemeToggle } from '@asafarim/react-themes';
153
+
154
+ function EcommerceDashboard() {
155
+ return (
156
+ <ThemeProvider defaultMode="auto" persistMode={true}>
157
+ <header className="dashboard-header">
158
+ <h1>Sales Dashboard</h1>
159
+ <ThemeToggle size="sm" showLabels={true} />
160
+ </header>
161
+ <main className="dashboard-content">
162
+ {/* Dashboard content adapts automatically */}
163
+ </main>
164
+ </ThemeProvider>
165
+ );
166
+ }
167
+ ```
168
+
169
+ #### ๐Ÿ“ฑ **Mobile-First Design**
170
+
171
+ ```css
172
+ /* Responsive design that adapts to theme */
173
+ .mobile-card {
174
+ background: var(--theme-color-background-secondary);
175
+ border: 1px solid var(--theme-color-border);
176
+ padding: var(--theme-spacing-md);
177
+ border-radius: var(--theme-radius-lg);
178
+
179
+ /* Automatic dark mode styling */
180
+ box-shadow: var(--theme-shadow-sm);
181
+ transition: var(--theme-transition-normal);
182
+ }
183
+ ```
184
+
185
+ #### ๐ŸŽจ **Design Systems**
186
+
187
+ ```tsx
188
+ // Integration with component libraries
189
+ import { Button, Card } from 'your-ui-library';
190
+ import { useTheme } from '@asafarim/react-themes';
191
+
192
+ function ThemedComponents() {
193
+ const { currentTheme } = useTheme();
194
+
195
+ return (
196
+ <Card
197
+ style={{
198
+ backgroundColor: currentTheme.colors.background,
199
+ color: currentTheme.colors.text
200
+ }}
201
+ >
202
+ <Button variant={currentTheme.mode === 'dark' ? 'outlined' : 'filled'}>
203
+ Themed Button
204
+ </Button>
205
+ </Card>
206
+ );
207
+ }
208
+ ```
209
+
210
+ ### ๐Ÿ”„ **Advanced Patterns**
211
+
212
+ #### ๐ŸŽช **Dynamic Theme Loading**
213
+
214
+ ```tsx
215
+ // Load themes dynamically based on user preferences
216
+ import { createTheme, useTheme } from '@asafarim/react-themes';
217
+
218
+ function DynamicThemeLoader() {
219
+ const { setTheme } = useTheme();
220
+
221
+ const loadUserTheme = async (userId: string) => {
222
+ const userPrefs = await fetch(`/api/users/${userId}/theme`);
223
+ const themeData = await userPrefs.json();
224
+
225
+ const customTheme = createTheme(themeData);
226
+ setTheme(customTheme);
227
+ };
228
+
229
+ return <div>Loading personalized theme...</div>;
230
+ }
231
+ ```
232
+
233
+ #### ๐Ÿข **Multi-Brand Applications**
234
+
235
+ ```tsx
236
+ // Switch between different brand themes
237
+ const brandThemes = {
238
+ corporate: createTheme(lightTheme, {
239
+ name: 'corporate',
240
+ colors: { primary: '#0066cc', secondary: '#004499' }
241
+ }),
242
+ creative: createTheme(darkTheme, {
243
+ name: 'creative',
244
+ colors: { primary: '#ff6b6b', secondary: '#4ecdc4' }
245
+ })
246
+ };
247
+
248
+ <ThemeProvider customThemes={brandThemes}>
249
+ <BrandSwitcher />
250
+ </ThemeProvider>
251
+ ```
252
+
253
+ ## ๐Ÿ“– API Reference
254
+
255
+ ### ๐Ÿ—๏ธ ThemeProvider
256
+
257
+ The foundational component that manages theme state and applies CSS variables throughout your application.
258
+
259
+ ```tsx
260
+ interface ThemeProviderProps {
261
+ children: ReactNode;
262
+ defaultMode?: 'light' | 'dark' | 'auto';
263
+ defaultTheme?: string;
264
+ persistMode?: boolean;
265
+ storageKey?: string;
266
+ customThemes?: Record<string, Theme>;
267
+ config?: ThemeConfig;
268
+ }
269
+ ```
270
+
271
+ **Essential Props:**
272
+
273
+ | Prop | Type | Default | Description |
274
+ |------|------|---------|-------------|
275
+ | `children` | `ReactNode` | **required** | Child components to provide theme context to |
276
+ | `defaultMode` | `'light' \| 'dark' \| 'auto'` | `'auto'` | Initial theme mode on first load |
277
+ | `defaultTheme` | `string` | `'default'` | Name of the default theme to use |
278
+ | `persistMode` | `boolean` | `true` | Whether to save user's theme choice to localStorage |
279
+ | `storageKey` | `string` | `'asafarim-theme-mode'` | localStorage key for persistence |
280
+ | `customThemes` | `Record<string, Theme>` | `{}` | Additional themes to make available |
281
+
282
+ **Advanced Configuration:**
283
+
284
+ ```tsx
285
+ // Extended configuration options
286
+ interface ThemeConfig {
287
+ transitionDuration?: string;
288
+ breakpoints?: Record<string, string>;
289
+ enableSystemTheme?: boolean;
290
+ cssVariablePrefix?: string;
291
+ }
292
+
293
+ <ThemeProvider
294
+ config={{
295
+ transitionDuration: '200ms',
296
+ enableSystemTheme: true,
297
+ cssVariablePrefix: 'app-theme'
298
+ }}
299
+ >
300
+ <App />
301
+ </ThemeProvider>
302
+ ```
303
+
304
+ ### ๐Ÿช useTheme Hook
305
+
306
+ The primary hook for accessing and controlling theme state.
307
+
308
+ ```tsx
309
+ interface UseThemeReturn {
310
+ currentTheme: Theme; // Currently active theme object
311
+ mode: ThemeMode; // Current mode: 'light' | 'dark' | 'auto'
312
+ setMode: (mode: ThemeMode) => void; // Change theme mode
313
+ setTheme: (theme: Theme) => void; // Change active theme
314
+ themes: Record<string, Theme>; // All available themes
315
+ toggleMode: () => void; // Cycle through light โ†’ dark โ†’ auto
316
+ }
317
+ ```
318
+
319
+ **Real-world Example:**
320
+
321
+ ```tsx
322
+ function ThemeAwareComponent() {
323
+ const { currentTheme, mode, setMode, toggleMode } = useTheme();
324
+
325
+ // Conditional styling based on theme
326
+ const isDarkMode = mode === 'dark' ||
327
+ (mode === 'auto' && window.matchMedia('(prefers-color-scheme: dark)').matches);
328
+
329
+ return (
330
+ <div style={{
331
+ backgroundColor: currentTheme.colors.background,
332
+ color: currentTheme.colors.text
333
+ }}>
334
+ <h2>Current Theme: {currentTheme.name}</h2>
335
+ <p>Mode: {mode} {isDarkMode ? '๐ŸŒ™' : 'โ˜€๏ธ'}</p>
336
+ <button onClick={toggleMode}>Toggle Theme</button>
337
+ </div>
338
+ );
339
+ }
340
+ ```
341
+
342
+ ### โšก useThemeToggle Hook
343
+
344
+ Simplified hook specifically for theme mode toggling with additional utilities.
345
+
346
+ ```tsx
347
+ interface UseThemeToggleReturn {
348
+ mode: ThemeMode; // Current theme mode
349
+ setMode: (mode: ThemeMode) => void; // Set specific mode
350
+ toggleMode: () => void; // Cycle through modes
351
+ isDark: boolean; // true if dark mode is active
352
+ isLight: boolean; // true if light mode is active
353
+ isAuto: boolean; // true if auto mode is active
354
+ effectiveMode: 'light' | 'dark'; // Resolved mode (auto becomes light/dark)
355
+ }
356
+ ```
357
+
358
+ **Practical Usage:**
359
+
360
+ ```tsx
361
+ function SmartThemeButton() {
362
+ const { mode, toggleMode, isDark, effectiveMode } = useThemeToggle();
363
+
364
+ const getIcon = () => {
365
+ if (mode === 'auto') return '๐ŸŒ“';
366
+ return isDark ? '๐ŸŒ™' : 'โ˜€๏ธ';
367
+ };
368
+
369
+ const getLabel = () => {
370
+ if (mode === 'auto') return `Auto (${effectiveMode})`;
371
+ return mode === 'dark' ? 'Dark Mode' : 'Light Mode';
372
+ };
373
+
374
+ return (
375
+ <button onClick={toggleMode} title={getLabel()}>
376
+ {getIcon()} {getLabel()}
377
+ </button>
378
+ );
379
+ }
380
+ ```
381
+
382
+ ### Components
383
+
384
+ #### ThemeToggle
385
+
386
+ A pre-built theme toggle button.
387
+
388
+ ```tsx
389
+ <ThemeToggle
390
+ size="md" // 'sm' | 'md' | 'lg'
391
+ showLabels={false} // Show text labels
392
+ className="custom-class"
393
+ style={{ margin: '10px' }}
394
+ />
395
+ ```
396
+
397
+ #### ThemeSelector
398
+
399
+ A dropdown selector for theme modes.
400
+
401
+ ```tsx
402
+ <ThemeSelector
403
+ showLabels={true}
404
+ className="custom-class"
405
+ options={[
406
+ { mode: 'light', label: 'Light', icon: 'โ˜€๏ธ' },
407
+ { mode: 'dark', label: 'Dark', icon: '๐ŸŒ™' },
408
+ { mode: 'auto', label: 'Auto', icon: '๐ŸŒ“' }
409
+ ]}
410
+ />
411
+ ```
412
+
413
+ ## ๐ŸŽจ Custom Themes
414
+
415
+ ### Creating Custom Themes
416
+
417
+ ```tsx
418
+ import { createTheme, lightTheme } from '@asafarim/react-themes';
419
+
420
+ const myCustomTheme = createTheme(lightTheme, {
421
+ name: 'my-theme',
422
+ colors: {
423
+ primary: '#ff6b6b',
424
+ primaryHover: '#ff5252',
425
+ background: '#f8f9fa',
426
+ text: '#212529'
427
+ }
428
+ });
429
+
430
+ // Use with provider
431
+ <ThemeProvider customThemes={{ 'my-theme': myCustomTheme }}>
432
+ <App />
433
+ </ThemeProvider>
434
+ ```
435
+
436
+ ### Using CSS Variables
437
+
438
+ The package automatically injects CSS variables that you can use in your styles:
439
+
440
+ ```css
441
+ .my-component {
442
+ background-color: var(--theme-color-background);
443
+ color: var(--theme-color-text);
444
+ border: 1px solid var(--theme-color-border);
445
+ border-radius: var(--theme-radius-md);
446
+ padding: var(--theme-spacing-md);
447
+ transition: all var(--theme-transition-normal);
448
+ }
449
+
450
+ .my-button {
451
+ background-color: var(--theme-color-primary);
452
+ color: white;
453
+ font-size: var(--theme-font-size-sm);
454
+ }
455
+
456
+ .my-button:hover {
457
+ background-color: var(--theme-color-primary-hover);
458
+ }
459
+ ```
460
+
461
+ ## ๐ŸŽฏ Integration with @asafarim/dd-menu
462
+
463
+ This package works seamlessly with `@asafarim/dd-menu`:
464
+
465
+ ```tsx
466
+ import { DDMenu } from '@asafarim/dd-menu';
467
+ import { useTheme } from '@asafarim/react-themes';
468
+
469
+ function NavMenu() {
470
+ const { mode } = useTheme();
471
+
472
+ return (
473
+ <DDMenu
474
+ items={menuItems}
475
+ theme={mode} // Pass current theme mode
476
+ variant="navbar"
477
+ />
478
+ );
479
+ }
480
+ ```
481
+
482
+ ## ๐Ÿš€ Live Demo & Showcase
483
+
484
+ ### ๐ŸŽญ **Interactive Demo**
485
+
486
+ Experience all features at **[bibliography.asafarim.com/react-themes/demo](https://bibliography.asafarim.com/react-themes/demo)**
487
+
488
+ The demo is a comprehensive showcase featuring:
489
+
490
+ #### ๐ŸŽจ **Theme Gallery**
491
+
492
+ - **Light Theme**: Clean, modern interface with excellent readability
493
+ - **Dark Theme**: Elegant dark mode optimized for low-light environments
494
+ - **Auto Mode**: Intelligent system preference detection with seamless switching
495
+ - **Custom Themes**: Examples of brand-specific and specialized themes
496
+
497
+ #### ๐Ÿ› ๏ธ **Component Showcase**
498
+
499
+ - **ThemeToggle Variants**: Different sizes, styles, and label configurations
500
+ - **ThemeSelector**: Dropdown with icons, labels, and custom options
501
+ - **Integration Examples**: Real components using theme variables
502
+ - **Performance Metrics**: Live transition timing and smoothness demos
503
+
504
+ #### ๐Ÿ“Š **Technical Demonstrations**
505
+
506
+ - **CSS Variables Live**: Watch variables update in real-time as themes change
507
+ - **Browser Compatibility**: Cross-browser testing interface
508
+ - **Accessibility Features**: Screen reader announcements and keyboard navigation
509
+ - **Mobile Responsiveness**: Touch-optimized controls and layouts
510
+
511
+ #### ๐Ÿ”ง **Developer Tools**
512
+
513
+ - **Code Examples**: Copy-paste ready implementations
514
+ - **Theme Inspector**: Live theme object visualization
515
+ - **CSS Variable Explorer**: All available variables with current values
516
+ - **Performance Monitor**: Bundle size and render time metrics
517
+
518
+ ### ๐Ÿ“ฑ **Mobile-Optimized Experience**
519
+
520
+ The demo is fully responsive and showcases:
521
+
522
+ - Touch-friendly theme controls
523
+ - Swipe gestures for theme switching
524
+ - Adaptive layouts for different screen sizes
525
+ - Battery-conscious animations
526
+
527
+ ### ๐ŸŽฏ **Use Cases Demonstrated**
528
+
529
+ 1. **E-commerce Interface**: Product cards, navigation, and checkout flows
530
+ 2. **Dashboard Layout**: Charts, tables, and control panels
531
+ 3. **Content Management**: Text editors, media galleries, and forms
532
+ 4. **Social Platform**: Posts, comments, and user profiles
533
+ 5. **Documentation Site**: Code blocks, navigation, and search interfaces
534
+
535
+ ## ๐Ÿ”ง Advanced Usage
536
+
537
+ ### Custom Theme Structure
538
+
539
+ ```tsx
540
+ interface Theme {
541
+ name: string;
542
+ mode: 'light' | 'dark' | 'auto';
543
+ colors: {
544
+ background: string;
545
+ backgroundSecondary: string;
546
+ text: string;
547
+ textSecondary: string;
548
+ primary: string;
549
+ primaryHover: string;
550
+ border: string;
551
+ // ... more colors
552
+ };
553
+ spacing: {
554
+ xs: string;
555
+ sm: string;
556
+ md: string;
557
+ lg: string;
558
+ // ... more spacing
559
+ };
560
+ // ... typography, radius, transitions, zIndex
561
+ }
562
+ ```
563
+
564
+ ### Programmatic Theme Application
565
+
566
+ ```tsx
567
+ import { applyTheme } from '@asafarim/react-themes';
568
+
569
+ // Apply theme manually
570
+ applyTheme(customTheme, 'dark');
571
+ ```
572
+
573
+ ## ๐ŸŒ Browser Support
574
+
575
+ - Modern browsers with CSS custom properties support
576
+ - Chrome 49+
577
+ - Firefox 31+
578
+ - Safari 9.1+
579
+ - Edge 16+
580
+
581
+ ## ๐Ÿค Contributing
582
+
583
+ We welcome contributions! The project is open source and actively maintained.
584
+
585
+ ### ๐Ÿ› ๏ธ **Development Setup**
586
+
587
+ ```bash
588
+ git clone https://github.com/AliSafari-IT/asafarim
589
+ cd ASafariM.Clients/packages/react-themes
590
+ pnpm install
591
+ pnpm build
592
+ pnpm test
593
+ ```
594
+
595
+ ### ๐Ÿงช **Testing the Demo**
596
+
597
+ ```bash
598
+ # Run the demo locally
599
+ cd ../../asafarim-bibliography
600
+ pnpm install
601
+ pnpm start
602
+ # Visit http://localhost:3004/react-themes/demo
603
+ ```
604
+
605
+ ### ๐Ÿ“‹ **Contribution Guidelines**
606
+
607
+ - Follow TypeScript best practices
608
+ - Add tests for new features
609
+ - Update documentation and examples
610
+ - Ensure accessibility compliance
611
+ - Test across different browsers
612
+
613
+ ## ๐Ÿ“„ License
614
+
615
+ MIT License - see the [LICENSE](LICENSE) file for details.
616
+
617
+ ## ๐ŸŒŸ **Why Choose @asafarim/react-themes?**
618
+
619
+ ### โœ… **Production Ready**
620
+
621
+ - Used in production at [ASafariM Bibliography](https://bibliography.asafarim.com)
622
+ - Thoroughly tested across browsers and devices
623
+ - Optimized for performance and accessibility
624
+ - Regular updates and maintenance
625
+
626
+ ### ๐ŸŽฏ **Developer Focused**
627
+
628
+ - Extensive TypeScript support
629
+ - Comprehensive documentation with live examples
630
+ - Active community support
631
+ - Regular feature updates based on user feedback
632
+
633
+ ### ๐Ÿš€ **Modern Standards**
634
+
635
+ - React 18+ optimized
636
+ - CSS3 custom properties
637
+ - ES2020+ JavaScript features
638
+ - Modern bundling and tree-shaking support
639
+
640
+ ## ๐Ÿ”— Related Packages & Ecosystem
641
+
642
+ - **[`@asafarim/dd-menu`](https://www.npmjs.com/package/@asafarim/dd-menu)** - Elegant dropdown menu component with theme integration
643
+ - **[ASafariM Bibliography](https://bibliography.asafarim.com)** - Live application showcasing the theme system
644
+ - **[Interactive Demo](https://bibliography.asafarim.com/react-themes/demo)** - Comprehensive feature demonstration
645
+
646
+ ## ๏ฟฝ Project Stats
647
+
648
+ - ๐Ÿ—๏ธ **Built with**: TypeScript, React 18, CSS3 Custom Properties
649
+ - ๐Ÿ“ฆ **Bundle Size**: ~8KB gzipped
650
+ - ๐ŸŒ **Browser Support**: Modern browsers (Chrome 49+, Firefox 31+, Safari 9.1+, Edge 16+)
651
+ - โšก **Performance**: Zero-flicker theme switching, optimized re-renders
652
+ - โ™ฟ **Accessibility**: WCAG 2.1 AA compliant
653
+
654
+ ## ๏ฟฝ๐Ÿ“ Changelog
655
+
656
+ ### ๐ŸŽ‰ **v1.1.0** - Latest
657
+
658
+ - Enhanced TypeScript definitions
659
+ - Improved performance and bundle size
660
+ - Added comprehensive demo showcase
661
+ - Extended browser compatibility
662
+ - New theme customization options
663
+
664
+ ### ๐Ÿš€ **v1.0.0** - Initial Release
665
+
666
+ - Core theme provider functionality
667
+ - Auto mode detection with system preference sync
668
+ - CSS variable injection system
669
+ - Built-in components (ThemeToggle, ThemeSelector)
670
+ - TypeScript support with full type safety
671
+ - localStorage persistence with customizable keys
672
+
673
+ ---
674
+
675
+ <div align="center">
676
+
677
+ ### ๐ŸŒŸ **Experience the Future of React Theming**
678
+
679
+ **[Try the Live Demo](https://alisafari-it.github.io/react-themes)** | **[View Documentation](https://www.npmjs.com/package/@asafarim/react-themes)** | **[See Source Code](https://github.com/AliSafari-IT/react-themes)**
680
+
681
+ Made with โค๏ธ and โ˜• by **[ASafariM](https://asafarim.com)**
682
+
683
+ *Empowering developers to create beautiful, accessible, and user-friendly themed applications*
684
+
685
+ </div>