Hex representation of a color with alpha channel?

前端 未结 5 2119
情书的邮戳
情书的邮戳 2020-11-27 16:23

Is there a W3 or any other noteworthy standard on how to represent a color (including alpha channel) in hex format?

Is it #RGBA or #ARGB?

5条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-11-27 16:51

    It looks like there is no hex alpha format: http://www.w3.org/TR/css3-color/

    Anyway, if you use a CSS preprocessor like SASS then you can pass an hex to rgba: background:

    rgba(#000, 0.5);
    

    And the preprocessor just converts the hex code to rgb automatically.

提交回复
热议问题