title: Convert opacity to hex in Javascript
body: <p>What would be the preferred way to convert opacity (0 - 1) to hex (00 - ff) in Javascript?</p>
  
  <p>My thoughts are to use an if statement to check if opacity is between 1 and 0.95 then use ff. Work my way down to 0.</p>