31

I use css framework Materialize.css I don't understand where past color in my HTML icon

<i class="large material-icons">note_add</i>

I have tried cyan darken-4

<i class="large material-icons cyan darken-4">note_add</i>

But nothing succeeded, I need exactly change color icon. How to make it?

dippas
  • 58,591
  • 15
  • 114
  • 126
HeartOfprogrammer
  • 527
  • 2
  • 5
  • 8

7 Answers7

88

Add the class of "cyan-text" & "text-darken-4" to the .

<i class="large material-icons cyan-text text-darken-4">note_add</i>
Christopher
  • 1,019
  • 1
  • 7
  • 12
  • 1
    This works in 2022 and the accepted answer below no longer works. Change `cyan` to your color of choice. For example: `large material-icons purple-text text-darken-1` – Olney1 Oct 13 '22 at 19:23
24

You can do this by adding a class to your icon like below-

<i class="large material-icons icon-blue">note_add</i>

And then in your CSS stylesheet, you can define the color for the icon-blue class

i.icon-blue {
    color: blue;
}

Your icon color will then be changed. Hope this helps!

Shekhar Chikara
  • 3,786
  • 2
  • 29
  • 52
  • While this does work, you're not taking advantage of the built in Materialize classes. See https://stackoverflow.com/a/37537496/6402953 – Christopher Dec 23 '22 at 20:58
20

It's easy, I'll show you an example:

 <i class="material-icons large red-text">room</i>

Just enter the name before the text (red-text)

7

I got an example with using the "style" attribute.

<pre></td><td class="col-sm-2"><i class="little material-icons" style="color:blue">search</i></pre>
Nick Cuevas
  • 1,474
  • 15
  • 10
1

According to Materialize documentation you can access their direct css attributes.

0

Hey you asking that you want to change icon colour in Materialize CSS. Same was my Question But i have Find the ans....that

<i class="material-icons red-text" >home</i>

This Code will change the icon Color and if we want to give its background color just change it in custom.css

.class {background-color:red;}
atiquratik
  • 1,296
  • 3
  • 27
  • 34
Deepak
  • 1
  • 1
-1

If you want to use Jquery

  • This will change color of all the material icons

$(".material-icons").css("color", themeColor);

  • This will change color of the material icons inside an element eg input field

$(".input-field>.material-icons").css("color", themeColor);

Live Demo

See the Pen Materialize CSS Change Theme Color by Hitesh Sahu (@hiteshsahu) on CodePen.
Hitesh Sahu
  • 41,955
  • 17
  • 205
  • 154