Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Font-Awesome fa-circle with two colors?

Tags:

html

css

I'm trying to get a half circle like onto my page but I'm struggling a bit using fa fa-adjust

<i class="fa fa-adjust" style="color: green"></i>

At this point I cant change the left side of the circle. Can a CSS wizard please help me so I can configure the two colors of the circle? I want the right side to be green and the left to be gray.

Below is the circle I want(ideally), WITH the same CSS settings as the "fa-circle". I was hoping I could copy the fa-circle CSS and then create some CSS tweaks. When I navigated to the fontawesome.css file there were basically codes for each type and thus I couldn't make any mods.

Any help would be great. Thanks guys!

http://imgur.com/nRRxbxY

enter image description here

like image 258
Spets Avatar asked Sep 21 '15 22:09

Spets


People also ask

How do I combine two icons in fa?

To stack multiple icons, use the fa-stack class on the parent HTML element of the 2 icons you want to stack. Then add the fa-stack-1x class for the regularly sized icon and add the fa-stack-2x class for the larger icon. fa-inverse can be added to the icon with the fa-stack-1x to help with a knock-out looking effect.

What is the difference between FAS and fa in Font Awesome?

fas - solid icons are usually filled with transparent outlines. far regular and fal light are similar. These icons are different than fas solid because they are mostly outlines and differ only in outline width. fal light icons have thinner outline compared to far regular.

Is Font Awesome no longer free?

Font Awesome Free is free, open source, and GPL friendly. You can use it for commercial projects, open source projects, or really almost whatever you want.


4 Answers

Use a CSS gradient:

https://jsfiddle.net/ryanpcmcquen/n5kjjvx9/

.fa-adjust, .no-font-needed {
    color: transparent;
    background: linear-gradient(to right, #868789 0%, #868789 50%, #008000 50%, #008000 100%);
    border-radius: 50%;
    width: 300px;
    height: 300px;
}
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/latest/css/font-awesome.min.css" rel="stylesheet" />
<i class="fa fa-adjust"></i>

<p>Although, you do not need Font Awesome to do this:</p>
<div class="no-font-needed"></div>

To be totally honest though, there is no need to use Font Awesome to accomplish this, as you can see, I do the same thing with a plain old <div> in my example.

like image 190
ryanpcmcquen Avatar answered Sep 23 '22 12:09

ryanpcmcquen


.badge {
    color: #FFF;
    height: 50px;
    width: 50px;
    text-align: center;
    line-height: 50px;
    background-image: linear-gradient(to left, green, green 50%, #777777 50%);
    border-radius: 100%;
}

<i class="badge fa fa-adjust" ></i>

use a gradient background

http://jsfiddle.net/ddpxug88/

like image 26
Destination Designs Avatar answered Sep 21 '22 12:09

Destination Designs


I don't think you can achieve this with font-awesome. Try using this: http://bryanhadaway.com/how-to-create-circles-with-css/

   .left {
       border-top-left-radius:50px; float:left;
       border-bottom-left-radius:50px;
       background:blue;
   }

jsfiddle demo here.

like image 35
raney24 Avatar answered Sep 20 '22 12:09

raney24


The Font Awesome answer would be to use Font Awesome's font stacking to stack two squares on top of one another offset the the green one and then wrap a white border with a 50% radius around the fonts to mask the squares into a circle.

Here's a starting point

<span class="fa-stack fa-lg">
  <i class="fa fa-square fa-stack-2x grey"></i>
  <i class="fa fa-square fa-stack-2x green"></i>
</span>

.green { color:green;left:50%;}
.grey { color:grey;}

EDIT;

Actually fa-adjust is the icon I was looking for (I should read the question properly).

This is a better example using font-awesome

<span class="fa-stack fa-lg">
    <i class="fa fa-adjust fa-stack-2x green"></i>
  <i class="fa fa-adjust fa-rotate-180 fa-stack-2x grey"></i>
</span>

.green { color:green;}
.grey { color:grey;}
like image 38
Dom UIXNZ Avatar answered Sep 21 '22 12:09

Dom UIXNZ