1

is there any possibility to change the color of glyphicons from bootstrap v2.3.2 without the migration in bootstrap v3.x? I use, for example, this class:

<i class="icon-edit"></i>

I would be happy, if you can help me.

Greets,

cimbom
  • 259
  • 1
  • 5
  • 23

2 Answers2

5

Glyphicons in Bootstrap 2 are based on a PNG sprite. The only options you have that I see are:

  • changing the image itself and replacing references to it in Bootstrap's CSS
  • resorting to very exotic css features to change an image's color, though I'm unsure if this will work for glyphicons

In short, you can't really. Black and white (-white versions) are your only options.

Community
  • 1
  • 1
Jeroen
  • 60,696
  • 40
  • 206
  • 339
  • On behalf of those forced to work with legacy code – thank you for a comprehensive answer. This was surprisingly hard to find (*i.e.* took more than 1 Google search). – Priidu Neemre Oct 24 '19 at 14:27
4

As mentioned in the comments, this will be very hard to achieve in that version of bootstrap.

I'd recommend using Font Awsome

Font Awesome gives you scalable vector icons that can instantly be customized — size, color, drop shadow, and anything that can be done with the power of CSS.

Community
  • 1
  • 1
Nitsan Baleli
  • 5,393
  • 3
  • 30
  • 52
  • 1
    Thank you for your reply. I think it makes sense to change the icons in font awesome without changing bootstrap v2.3.2 in v3.x – cimbom Oct 01 '14 at 13:43
  • 1
    You don't even need to override the font-icon color. You can just create a class like `.red { color: red; }` and then apply that to the `` tag or the parent element and it _should_ override the color. That's a cleaner method IMO. Untested. – Jared Eitnier Oct 01 '14 at 13:48