A comprehensive Angular Material 16 application that demonstrates dynamic custom theming with real-time color picker, theme history, and showcase of all Material Design components.
- Real-time Color Picker: Change primary, accent, and warn colors instantly
- Draggable Theme Controller: Floating paint icon that can be positioned anywhere on screen
- Theme History: Automatically saves last 5 applied color schemes with timestamps
- Persistent Storage: Theme preferences and position saved to localStorage
- Light/Dark Mode: Toggle between light and dark theme schemes
- All Angular Material 16 Components: Comprehensive demonstration of every available component
- Interactive Examples: Live examples showing component functionality
- Responsive Design: Optimized for both desktop and mobile devices
- Component Navigation: Easy navigation between different component categories
- Hex Color Validation: Real-time validation of hex color inputs
- Color Preview: Visual preview circles for selected colors
- Theme Selection Highlighting: Visual indication of currently selected theme
- Delete Theme Functionality: Remove unwanted themes from history
- Auto-Reset to Default: Automatically resets when all custom themes are deleted
- Angular 16.1.0 - Modern Angular framework
- Angular Material 16.2.14 - Complete Material Design component library
- Angular CDK 16.2.14 - Component Development Kit for advanced functionality
- TypeScript 5.1.3 - Type-safe development
- SCSS - Enhanced CSS with variables and mixins
- RxJS 7.8.0 - Reactive programming with observables
- Node.js (version 16 or higher)
- npm or yarn package manager
- Angular CLI (optional but recommended)
-
Clone the repository
git clone https://github.com/yourusername/angular-material-16-dynamic-theme.git cd angular-material-16-dynamic-theme -
Install dependencies
npm install
-
Start the development server
npm start # or ng serve -
Open your browser Navigate to
http://localhost:4200/
-
Access Theme Picker
- Look for the floating paint icon (๐จ) in the bottom-right corner
- Click and drag to reposition the icon anywhere on screen
- Click the icon to open the theme customization dialog
-
Customize Colors
- Primary Color: Main brand color (required)
- Accent Color: Secondary accent color (optional)
- Warn Color: Error/warning color (optional)
- Use either the color picker or enter hex values directly
-
Apply Changes
- Click "Apply Theme" to save and apply your custom colors
- Your theme will be automatically saved to history
- The new theme will be applied instantly across all components
-
Manage Theme History
- View your last 5 applied themes in the history section
- Click any previous theme to reapply it
- Hover over themes to see delete option
- Delete unwanted themes with the red ร button
-
Navigation
- Use the main navigation to browse different component categories
- Each section demonstrates specific Material Design components
- Interactive examples show real component functionality
-
Theme Testing
- Apply different themes while exploring components
- See how your custom colors affect different UI elements
- Test both light and dark mode variations
src/
โโโ app/
โ โโโ core/
โ โ โโโ services/
โ โ โโโ theme.service.ts # Main theme management service
โ โโโ material/
โ โ โโโ components/ # Material component examples
โ โ โโโ material.module.ts # Material modules configuration
โ โ โโโ material-routing.module.ts # Component routing
โ โโโ shared/
โ โ โโโ components/
โ โ โ โโโ theme-color-picker/ # Draggable theme picker
โ โ โ โโโ breadcrumb/ # Navigation breadcrumb
โ โ โโโ models/
โ โ โ โโโ theme.models.ts # Theme-related interfaces
โ โ โโโ shared.module.ts # Shared components module
โ โโโ app.component.* # Root application component
โ โโโ app.module.ts # Main application module
โโโ assets/
โ โโโ styles/ # Global styles and theme files
โโโ styles.scss # Global application styles
Central service managing all theme operations:
- Theme initialization and persistence
- Color application and CSS variable management
- Theme history management
- Light/dark mode switching
Draggable component providing:
- Real-time color selection
- Position persistence
- Theme history management
- Validation and error handling
Comprehensive examples of:
- Form controls (inputs, selects, checkboxes, etc.)
- Navigation (menus, tabs, breadcrumbs)
- Layout (cards, dividers, expansion panels)
- Buttons and indicators (buttons, chips, badges)
- Data tables and lists
- Modals and overlays
- Extend the
ThemeSchemeenum intheme.models.ts - Add corresponding CSS classes in your global styles
- Update the theme service to handle new theme types
- Modify the default colors in
theme.service.ts - Add new color properties to the theme interface
- Update the color picker component to handle additional colors
- Override Material Design variables in
styles.scss - Create custom SCSS mixins for consistent theming
- Use CSS custom properties for dynamic color application
npm run buildnpm run build --prodnpm test- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Angular Team for the amazing framework
- Material Design Team for the design system
- Angular Material Team for the component library
If you encounter any issues or have questions:
- Check the Issues section
- Create a new issue with detailed description
- Provide steps to reproduce any bugs
Made with โค๏ธ using Angular Material 16