The bootstrap searches the color according to the already applied css on the page. For example, if you have an icon inside a link, and you have changed the color of the links in css, the icon will be the same color, example:
<!DOCTYPE html>
<html lang="pt">
<head>
<title>Bootstrap Example</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
<h2>Glyphicon Examples</h2>
<p>Envelope icon: <span class="glyphicon glyphicon-envelope"></span></p>
<p>Envelope icon as a link:
<a href="#"><span class="glyphicon glyphicon-envelope"></span></a>
</p>
<p>Search icon: <span class="glyphicon glyphicon-search"></span></p>
<p>Search icon on a button:
<button type="button" class="btn btn-default">
<span class="glyphicon glyphicon-search"></span> Search
</button>
</p>
<p>Search icon on a styled button:
<button type="button" class="btn btn-info">
<span class="glyphicon glyphicon-search"></span> Search
</button>
</p>
<p>Print icon: <span class="glyphicon glyphicon-print"></span></p>
<p>Print icon on a styled link button:
<a href="#" class="btn btn-success btn-lg">
<span class="glyphicon glyphicon-print"></span> Print
</a>
</p>
</div>
</body>
</html>
Source: w3schools.
From the version 3.0 of bootstrap you can change the size of an icon just by changing the attribute color
of the CSS. Example:
.pink{
color: pink;
}
<!DOCTYPE html>
<html lang="pt">
<head>
<title>Bootstrap Example</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
<h2>Glyphicon Examplos</h2>
<p>CSS Inline: <span class="glyphicon glyphicon-envelope" style="color:red;"></span></p>
<p>Adicionando classe:
<a href="#"><span class="glyphicon glyphicon-envelope pink"></span></a>
</p>
</div>
</body>
</html>
Remembering that you can change the size of the icon with the attribute font-size
, as in the example below:
.fonte-maior{
font-size: 40px;
}
<!DOCTYPE html>
<html lang="pt">
<head>
<title>Bootstrap Example</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
<h2>Glyphicon Examplos</h2>
<p>Sem fonte:
<a href="#"><span class="glyphicon glyphicon-envelope"></span></a>
</p>
<p>Com fonte:
<a href="#"><span class="glyphicon glyphicon-envelope fonte-maior"></span></a>
</p>
</div>
</body>
</html>
You can change the color of the icons by adding a new class that is responsible for adding the new desired color. The same as in this question, only changes the Library.
– Chun