Convert opacity to hex in Javascript

Posted by John on Stack Overflow See other posts from Stack Overflow or by John
Published on 2010-05-20T19:54:33Z Indexed on 2010/05/20 20:00 UTC
Read the original article Hit count: 103

Filed under:
|

What would be the preferred way to convert opacity (0 - 1) to hex (00 - ff) in Javascript?

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.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about hex