我有很大的困难来实现一个定制的主题角2材料。我一直在以下网站跟踪导游:
并为我的颜色生成了自定义调色板。例如,我的“主”颜色:
$dz-primary: (
50 : #e8ebee,
100 : #c6cdd4,
200 : #a0acb7,
300 : #7a8a9a,
400 : #5e7184,
500 : #41586e,
600 : #3b5066,
700 : #32475b,
800 : #2a3d51,
900 : #1c2d3f,
A100 : #82baff,
A200 : #4f9eff,
A400 : #1c83ff,
A700 : #0275ff,
contrast: (
50 : #000000,
100 : #000000,
200 : #000000,
300 : #000000,
400 : #ffffff,
500 : #ffffff,
600 : #ffffff,
700 : #ffffff,
800 : #ffffff,
900 : #ffffff,
A100 : #000000,
A200 : #000000,
A400 : #ffffff,
A700 : #ffffff,
)
);在尝试创建自定义主题时:
@import '~@angular/material/theming';
@include mat-core();
@import './theme/dz-primary';
@import './theme/dz-accent';
$dz-theme-primary: mat-pallete($dz-primary);
$dz-theme-accent: mat-pallete($dz-accent);
$dz-theme: mat-light-theme($dz-theme-primary, $dz-theme-accent);
@include angular-material-theme($dz-theme);编译器总是返回:
参数
$mapofmap-get($map, $key)必须是映射 回溯: node_modules/@angular/material/_theming.scss:1118,in functionmap-getnode_modules/@angular/material/_theming.scss:1118,in functionmat-colornode_modules/@angular/material/_theming.scss:1530,in mixinmat-option-themenode_modules/@angular/material/_theming.scss:3854,in mixinmat-core-themenode_modules/@angular/material/_theming.scss:3920,在C:\Users\Brandon\work\angular-apps\dz-ui\node_modules\@angular\material_theming.scss中angular-material-themestdin:11 (第1118行,第11栏)
这似乎是mat-color()函数不接受调色板的问题,但我似乎找不到问题所在。
我也尝试使用本教程中引用的材料中内置的颜色,但我也收到了同样的错误。
发布于 2018-01-06 05:15:17
看起来你把mat-palette拼成了mat-pallete。
$dz-theme-primary: mat-palette($dz-primary); // <- Here
$dz-theme-accent: mat-palette($dz-accent); // <- Here
$dz-theme: mat-light-theme($dz-theme-primary, $dz-theme-accent);https://stackoverflow.com/questions/48119179
复制相似问题