title: Sass - Converting Hex to RGBa for background opacity
body: <p>I have the following Sass mixin, which is a half complete modification of an <strong>RGBa example</strong>:</p>
  
  <pre class="lang-css prettyprint-override"><code>@mixin background-opacity($color, $opacity: .3) {
      background: rgb(200, 54, 54); /* The Fallback */
      background: rgba(200, 54, 54, $opacity);
  } 
  </code></pre>
  
  <p>I have applied <code>$opacity</code> ok, but now I am a stuck with the <code>$color</code> part. 
  The colors I will be sending into the mixin will be HEX not RGB.</p>
  
  <p>My example use will be:</p>
  
  <pre class="lang-css prettyprint-override"><code>element {
      @include background-opacity(#333, .5);
  }
  </code></pre>
  
  <p>How can I use HEX values within this mixin?</p>