How to set the color of an icon in Angular Material?

后端 未结 7 1654
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-04 23:48

I have this, which I would assume to work, but doesn\'t:

home
         


        
7条回答
  •  不思量自难忘°
    2021-02-04 23:55

    That's because the color input only accepts three attributes: "primary", "accent" or "warn". Hence, you'll have to style the icons the CSS way:

    1. Add a class to style your icon:

      .white-icon {
          color: white;
      }
      /* Note: If you're using an SVG icon, you should make the class target the `` element */
      .white-icon svg {
          fill: white;
      }
      
    2. Add the class to your icon:

      menu
      

提交回复
热议问题