[英]Angular Material access theme color
After some searching through SO and GitHub, I'd just like to get a clarification: There is NO WAY to access a theme color (or any other theme feature), for example to set a mat-card color:在通过 SO 和 GitHub 进行一些搜索之后,我只想得到一个澄清:没有办法访问主题颜色(或任何其他主题功能),例如设置垫卡颜色:
There are two options I can see:我可以看到两个选项:
Am I missing something?我错过了什么吗?
You can define a custom theme for main colors "accent, primary, warm".您可以为主要颜色“重音、主色、暖色”定义自定义主题。
https://material.angular.io/guide/theming#defining-a-custom-theme https://material.angular.io/guide/theming#defining-a-custom-theme
In other scenario, you could have directives to apply at components what add a custom class with your styles and nested css selectors.在其他情况下,您可以在组件上应用指令,这些指令使用您的样式和嵌套的 css 选择器添加自定义类。
Example:例子:
<mat-card yourDirectiveForCustomStyles></mat-card>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.