title: Why is the RGBA colour different to the hex code with transparency?
body: <p>I'm unsure why these two colours are different. If my assumption is correct, <code>rgb(255,0,0)</code> should be the same as <code>#ff0000</code> - and since they are the same, should <code>rgba(255,0,0,0.5)</code> also be the same as <code>#ff000050</code>? And if not, why, and what hex code could match the equivalent RGBA code?</p>
  <p>Why does this appear to not be the case? See the example below:</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-css lang-css prettyprint-override"><code>p:nth-child(1) {
    color: rgb(255, 0, 0);
  }
  p:nth-child(2) {
    color: #ff0000;
  }
  p:nth-child(3) {
    color: rgba(255, 0, 0, 0.5);
  }
  p:nth-child(4) {
    color: #ff000050;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;p&gt;One&lt;/p&gt;
  &lt;p&gt;Two&lt;/p&gt;
  &lt;p&gt;Three&lt;/p&gt;
  &lt;p&gt;Four&lt;/p&gt;</code></pre>
  </div>
  </div>
  </p>