title: How to convert "background-color" to rgb() format?
body: <p>Here is my problem:</p>
  
  <p>I want to change the opacity of background-color of one of the elements on my page. in order to do this I need to first convert the color to rgb() format. (or extract r, g and b elements ).</p>
  
  <p><a href="https://stackoverflow.com/questions/637921/opacity-of-background-but-not-the-text">here</a> I can see how to convert a hex string to numeric format but colors are not always in hex format. they can be named colors like "red".</p>
  
  <pre><code>red     ---&gt; rgb(255, 0, 0)
  #ff00ff ---&gt; rgb(255, 0, 255)
  </code></pre>
  
  <p>Does anybody have any idea how this can be done?</p>
  
  <p>Regards.</p>