Es ist wie das klingt kann sein, was Sie suchen
Um Ihre eigenen Komponenten mit kantigem Material des Werkzeug, um Stil, der die Arten Komponente muss mit Sass definiert werden.
Mit @mixin, um automatisch ein Thema anwenden
Warum
mit @mixin Der Vorteil einer @mixin Funktion besteht darin, dass, wenn Sie Ihr Design ändern, jede Datei, die es automatisch wird verwendet aktualisiert. Wenn Sie @mixin mit einem anderen Theme-Argument aufrufen, können mehrere Designs innerhalb der App oder Komponente angezeigt werden.
So verwenden @mixin
// Import all the tools needed to customize the theme and extract parts of it
@import '[email protected]/material/theming';
// Define a mixin that accepts a theme and outputs the color styles for the component.
@mixin candy-carousel-theme($theme) {
// Extract whichever individual palettes you need from the theme.
$primary: map-get($theme, primary);
$accent: map-get($theme, accent);
// Use mat-color to extract individual colors from a palette as necessary.
.candy-carousel {
background-color: mat-color($primary);
border-color: mat-color($accent, A400);
}
}
// Import a pre-built theme
@import '[email protected]/material/prebuilt-themes/deeppurple-amber.css';
// Import your custom input theme file so you can call the custom-input-theme function
@import 'app/candy-carousel/candy-carousel-theme.scss';
// Using the $theme variable from the pre-built theme you can call the theming function
@include candy-carousel-theme($theme);
https://material.angular.io/guide/theming-your-components