PostCSS plugin to transform color from #rgb.a to rgba().
/* Input examples */ .foo { color: black(.1) } .bar { color: white(0.2); } .baz { color: #0fc.3; } .woo { color: #00ffcc.45; } .hoo { border-color: #000 #000.5 white white(0.5); } .boo { text-shadow: 1px 1px 1px #0fc.1, 3px 3px 5px rgba(#fff, .5); }
/* Output examples */ .foo { color: rgba(0, 0, 0, 0.1); } .bar { color: rgba(255, 255, 255, 0.2); } .baz { color: rgba(0, 255, 204, 0.3); } .woo { color: rgba(0, 255, 204, 0.45); } .hoo { border-color: #000 rgba(0, 0, 0, 0.5) white rgba(255, 255, 255, 0.5); } .boo { text-shadow: 1px 1px 1px rgba(0, 255, 204, 0.1), 3px 3px 5px rgba(255, 255, 255, 0.5); }
Install
$ npm install postcss-color-alpha
Usage
postcss([ require('postcss-color-alpha') ])
See PostCSS docs for examples for your environment.