Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <!--
  This is a demo of some advanced ways of coloring and animating Font Awesome's duotone icons.

  1. We're calling all Font Awesome Pro styling and icons via a Font Awesome Kit. See the <head> section of this HTML for the exact syntax. Read more about kits at https://blog.fontawesome.com/introducing-font-awesome-kits-7134d1d59959

  2.The general layout and decorative styling are being handled by the CSS included in the "demo styling" portion of this pen's CSS - anything that starts with "demo-*" is demo styling and not needed for core functionality of the demo to work.

  3. We're using our SVG + JS implementation and some of the selectors used to target those are unique to that flavor of Font Awesome. If you're using Web Fonts, you'll need to target CSS pseudo elements instead.

  4. Remember to check out our full documentation at _____.
  -->

<html>
  <head>
    <title>Font Awesome Duotone Icons: Advanced Coloring</title>
    
    <script src="https://kit-pro.fontawesome.com/releases/v5.10.1/js/pro.min.js" data-auto-fetch-svg></script>
  </head>

  <body>
    <main class="demo-frame">
    <section class="demo">
      <article class="demo-example">
        <i class="fad fa-rainbow fa-fw"></i>
      </article>
      
      <article class="demo-example">
        <i class="fad fa-city fa-fw" style="--fa-secondary-color: rgb(255, 237, 153); --fa-secondary-opacity: 1.0;"></i>
      </article>
      
      <article class="demo-example">
        <i class="fad fa-vial fa-fw"></i>
      </article>
      
      <article class="demo-example">
        <i class="fad fa-skull fa-fw" style="--fa-secondary-opacity: 1.0;"></i>
      </article>
      
      <article class="demo-example">
        <i class="fad fa-fan fa-spin fa-fw fa-swap-opacity" style="--fa-primary-color: rgb(173, 181, 189); --fa-secondary-color: rgb(224, 49, 48);"></i>
      </article>
    </section>

    <section class="demo">
      <article class="demo-example">
        <i class="fad fa-pager fa-fw" style="--fa-secondary-opacity: 1.0;"></i>
      </article>
      
      <article class="demo-example">
        <i class="fad fa-sad-tear fa-fw" style="--fa-secondary-opacity: 1.0; --fa-primary-color: rgb(76, 171, 247); --fa-secondary-color: rgb(255, 212, 59);"></i>
      </article>
      
      <article class="demo-example">
        <i class="fad fa-angry fa-fw" style="--fa-secondary-opacity: 1.0;"></i>
      </article>
      
      <article class="demo-example">
        <i class="fad fa-grin-hearts fa-fw" style="--fa-primary-color: rgb(240, 62, 61); --fa-secondary-color: rgb(255, 212, 59); --fa-secondary-opacity: 1.0;"></i>
      </article>
      
      <article class="demo-example">
        <span class="fa-layers fa-fw">
          <i class="fas fa-globe-stand" style="color: tan;"></i>
          <i class="fad fa-globe-americas" data-fa-transform="shrink-5.5 up-2 left-0.5" style="--fa-primary-color: rgb(64, 192, 87); --fa-secondary-color: rgb(35, 139, 230); --fa-secondary-opacity: 1.0;"></i>
        </span>
      </article>
    </section>
    </main>
  </body>
</html>
              
            
!

CSS

              
                /* rainbow animation */
@keyframes colorCycle {
  0% { color   : rgb(35, 139, 230); }
  12.5% { color: rgb(16, 184, 133); }
  25% { color  : rgb(64, 192, 87); }
  37.5% { color: rgb(252, 196, 23); }
  50% { color  : rgb(255, 146, 43); }
  62.5% { color: rgb(250, 82, 82); }
  75% { color  : rgb(240, 101, 149); }
  87.5% { color: rgb(132, 94, 246); }
  100% { color : rgb(35, 139, 230); }
}

.fa-rainbow {
  animation: colorCycle 5s infinite linear;
}


@keyframes lightsFlicker {
  0%, 19.999%, 22%, 62.999%, 64%, 64.999%, 70%, 100% {
		opacity: .99;
	}
	20%, 21.999%, 63%, 63.999%, 65%, 69.999% {
		opacity: 0.4;
	}
}

.fa-city .fa-secondary {
  animation: lightsFlicker 3s infinite linear;
}

/* currently not working in Safari */
.fa-vial .fa-secondary {
  animation: colorCycle 10s infinite linear;
}

@keyframes skullColor {
  0% { color: rgb(255, 243, 191); }
  20% { color: rgb(255, 243, 191); }
  25% { color: rgb(224, 49, 48); }
  70% { color: rgb(224, 49, 48); }
  75% { color: rgb(255, 243, 191); }
  100% { color: rgb(255, 243, 191); }
}

@keyframes skullEyeColor {
  0% { color: rgb(32, 37, 40); }
  20% { color: rgb(32, 37, 40); }
  25% { color: rgb(255, 237, 153); }
  70% { color: rgb(255, 237, 153); }
  75% { color: rgb(32, 37, 40); }
  100% { color: rgb(32, 37, 40); }
}

/* currently not working in Safari */
.fa-skull .fa-primary {
  animation: skullEyeColor 5s infinite linear;
}

/* currently not working in Safari */
.fa-skull .fa-secondary {
  animation: skullColor 5s infinite linear;
}


@keyframes pagerBuzz {
  from { transform: scale3d(1, 1, 1); }

  10%, 20% {
    transform: scale3d(0.9, 0.9, 0.9) rotate3d(0, 0, 1, -3deg);
  }

  30%, 50%, 70%, 90% {
    transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, 3deg);
  }

  40%, 60%, 80% {
    transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, -3deg);
  }

  to { transform: scale3d(1, 1, 1); }
}

@keyframes pagerBuzzColor {
  0% { color: rgb(216, 245, 162); }
  40% { color: rgb(116, 184, 22); }
  80% { color: rgb(116, 184, 22); }
  100% { color: rgb(216, 245, 162); }
}

.fa-pager {
  animation: pagerBuzz 1.5s infinite linear;
}

/* currently not working in Safari */
.fa-pager .fa-secondary {
  animation: pagerBuzzColor 1.5s infinite linear;
}

.fa-sad-tear {
  transition: filter 0.25s ease-in-out;
  filter: grayscale(100%);
}

.fa-sad-tear:hover {
  filter: grayscale(0);
}

.fa-angry .fa-primary,
.fa-angry .fa-secondary {
  transition: color 0.5s ease-in-out;
}

.fa-angry .fa-secondary {
  color: rgb(255, 212, 59);
}

.fa-angry:hover .fa-primary {
  color: rgb(32, 37, 40);
}

.fa-angry:hover .fa-secondary {
  color: rgb(240, 62, 61);
}

.fa-grin-hearts:hover .fa-primary {
  transform: scale(1.1);
  transform-origin: center;
}


/* demo styling - just frosting + presentation - no need to copy this into your project. */
* {
  box-sizing: border-box;
}

 /* making a nice frame/layout for examples */
.demo-frame {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-bottom: -1rem;
  padding: 3rem;
  min-height: 100vh;
  color: rgb(52, 58, 64);
}

/* individual demo styling */
.demo {
  margin-right: -1.5rem;
  margin-bottom: -1.5rem;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  padding: 0;
}

/* individual example */
.demo-example {
  font-size: 5rem;
  padding: 1.5rem;
}
              
            
!

JS

              
                
              
            
!
999px

Console