Это оно..!
variables.scss
//---------------------------------------------------------
//Declare a global variable and set it to red color
//---------------------------------------------------------
$fg-primary-text: red;
//---------------------------------------------------------
//below @mixin is used in styles.scss to pass the custom-theme
//---------------------------------------------------------
@mixin cache-theme-colors($theme) {
@include set-global-variables($theme);
}
//---------------------------------------------------------
//local mixin to set the global-variable from the $theme using !global flag
//---------------------------------------------------------
@mixin set-global-variables($theme: $theme, $fg-primary-text: $fg-primary-text) {
$foreground: map-get($theme, foreground); //get foreground from the theme
$fg-primary-text: mat-color($foreground, text) !global; //get the text color from the theme and set it here using the !global flag
}
component.scss
@import "../../../../assets/themes/theme-variables.scss";
.text-color {
color: $fg-primary-text; //use the variable (but it is still red)
}
Но цвет все еще красный Мой вопрос: как установить глобальную переменную в scss и изменить ее внутри mixin / function и использовать ее в любом component.scss