指令中的角材料自定义主题

时间:2020-09-08 12:35:44

标签: angular

我用角形材料创建了自定义主题:

  $custom-collection: (
    warning :  #ffc312,
    success :  #00d5a5,
    dark:    #000000,
    light:    #A6A6A6,
    light1:    #F8F4F4,
    contrast: (
        warning :  #000000,
        success :  #FFFFFF,
        dark:    #FFFFFF,
        light:    #000000,
        light1:    #000000,
    )
);

$temp-app-custom: mat-palette($custom-collection, custom);
$temp-app-theme: mat-light-theme($theme-primary, $theme-accent, $theme-warn);
$temp-app-theme: map_merge($temp-app-theme, (custom: $temp-app-custom));
$custom: map-get($temp-app-theme, custom);

在components.scss中,我可以这样使用:

@import "variables";

.color-red {
    color: mat-color($custom, success);
    background-color: mat-color($custom, light)
}

但这不起作用

<button mat-raised-button color="warning">Primary</button>

在这方面是否需要帮助,以及如何帮助。

谢谢

0 个答案:

没有答案