Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change color of font awesome icons

I have a table that is produced using the ng-repeat.

When the user selects a table row I'm able to apply to highlight the table row and apply the specific class.

The problem is I am having trouble changing the icons with in that row also the highlighted row background-color is blue and the text changes to white but the icons remain blue.

CSS

.selected{
   background-color:#004b89;
   color:white;
   font-weight:bold;       
}

HTML

<tr ng-repeat="item in vm.items ng-class="{'selected':$index == vm.selectedRow}" class="table-striped" ng-click="vm.setClickedRow($index)">
<td><a  tooltip-placement="top"><i class="fa fa-pencil fa-2x link-icon"></i>     </a>
<td><a  tooltip-placement="top"><i class="fa fa-trash fa-2x link-icon"></i></a>
</tr>
like image 856
Troy Bryant Avatar asked May 22 '16 20:05

Troy Bryant


People also ask

How do you change the color of your text icon?

You can change the desktop icon font color from white to black in the 'Advanced System Settings'. To change the icon font color, right-click on the 'This PC' icon on the desktop and then select 'Properties' from the context menu. The System settings window will open with the 'About' tab on the screen by default.

Can I modify font awesome icons?

Select the SVG of font-awesome located in your extracted zip inside fonts. Repeat the procces uploading your own svg files. Inside Home (at the header of the page) Select the icons you want to download, customize them to give your custom names and select publish to have a link or download the fonts and css.

How do I change the size of font awesome icons?

To increase icon sizes relative to their container, use the fa-lg (33% increase), fa-2x , fa-3x , fa-4x , or fa-5x classes. If your icons are getting chopped off on top and bottom, make sure you have sufficient line-height.


1 Answers

select the font-awesome class you want to change the color, because could be a CSS specificity issue.

.not-selected .fa-pencil {
  color: red
}
.not-selected .fa-trash {
  color: green
}
.selected {
  background-color: #004b89;
  color: white;
  font-weight: bold;
}
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet" />
<table>
  <tr class="not-selected">
    <td><a tooltip-placement="top"><i class="fa fa-pencil fa-2x link-icon"></i></a>
      <td><a tooltip-placement="top"><i class="fa fa-trash fa-2x link-icon"></i></a>
  </tr>
  <tr class="selected">
    <td><a tooltip-placement="top"><i class="fa fa-pencil fa-2x link-icon"></i></a>
      <td><a tooltip-placement="top"><i class="fa fa-trash fa-2x link-icon"></i></a>
  </tr>
</table>
like image 70
dippas Avatar answered Oct 17 '22 05:10

dippas