Twitter\'s bootstrap uses Icons by Glyphicons. They are \"available in dark gray and white
\" by default:
It is actually very easy:
just use:
.icon-name{
color: #0C0;}
For example:
.icon-compass{
color: #C30;}
That's it.
Because the glyphicons are now fonts, one can use the contextual classes to apply the appropriate color to the icons.
For example:
<span class="glyphicon glyphicon-info-sign text-info"></span>
adding text-info
to the css will make the icon the info blue color.
Quick and dirty work around which did it for me, not actually coloring the icon, but surrounding it with a label or badge in the color you want;
<span class="label-important label"><i class="icon-remove icon-white"></i></span>
<span class="label-success label"><i class="icon-ok icon-white"></i></span>
I thought that I might add this snippet to this old post. This is what I had done in the past, before the icons were fonts:
<i class="social-icon linkedin small" style="border-radius:7.5px;height:15px;width:15px;background-color:white;></i>
<i class="social-icon facebook small" style="border-radius:7.5px;height:15px;width:15px;background-color:white;></i>
This is very similar to @frbl 's sneaky answer, yet it does not use another image. Instead, this sets the background-color of the <i>
element to white
and uses the CSS property border-radius
to make the entire <i>
element "rounded." If you noticed, the value of the border-radius
(7.5px) is exactly half that of the width
and height
property (both 15px, making the icon square), making the <i>
element circular.
With the latest release of Bootstrap RC 3, changing the color of the icons is as simple as adding a class with the color you want and adding it to the span.
Default black color:
<h1>Password Changed <span class="glyphicon glyphicon-ok"></span></h1>
would become
<h1>Password Changed <span class="glyphicon glyphicon-ok icon-success"></span></h1>
CSS
.icon-success {
color: #5CB85C;
}
Bootstrap 3 Glyphicons List
Just use the GLYPHICONS and you will be able to change color just setting the CSS:
#myglyphcustom {
color:#F00;
}