|
| 1 | +import {AppConfig} from '../utils/devkit-utils/config'; |
| 2 | + |
| 3 | +/** |
| 4 | + * Create custom theme for the given application configuration. |
| 5 | + */ |
| 6 | +export function createCustomTheme(app: AppConfig) { |
| 7 | + const name = app.name || 'app'; |
| 8 | +return ` |
| 9 | +// Custom Theming for Angular Material |
| 10 | +// For more information: https://material.angular.io/guide/theming |
| 11 | +@import '~@angular/material/theming'; |
| 12 | +// Plus imports for other components in your app. |
| 13 | +
|
| 14 | +// Include the common styles for Angular Material. We include this here so that you only |
| 15 | +// have to load a single css file for Angular Material in your app. |
| 16 | +// Be sure that you only ever include this mixin once! |
| 17 | +@include mat-core(); |
| 18 | +
|
| 19 | +// Define the palettes for your theme using the Material Design palettes available in palette.scss |
| 20 | +// (imported above). For each palette, you can optionally specify a default, lighter, and darker |
| 21 | +// hue. Available color palettes: https://www.google.com/design/spec/style/color.html |
| 22 | +$${name}-primary: mat-palette($mat-indigo); |
| 23 | +$${name}-accent: mat-palette($mat-pink, A200, A100, A400); |
| 24 | +
|
| 25 | +// The warn palette is optional (defaults to red). |
| 26 | +$${name}-warn: mat-palette($mat-red); |
| 27 | +
|
| 28 | +// Create the theme object (a Sass map containing all of the palettes). |
| 29 | +$${name}-theme: mat-light-theme($${name}-primary, $${name}-accent, $${name}-warn); |
| 30 | +
|
| 31 | +// Include theme styles for core and each component used in your app. |
| 32 | +// Alternatively, you can import and @include the theme mixins for each component |
| 33 | +// that you are using. |
| 34 | +@include angular-material-theme($${name}-theme); |
| 35 | +
|
| 36 | +`; |
| 37 | +} |
0 commit comments