rgba-translater

1.0.1 • Public • Published

RGBA translater

To translate rgba to 16 binary model

Usage:

npm install rgba-translater

Use to translate backgroundColor to compatible ie8

//require translater
var RGBATranslater = require('rgba-translater');  
 
var ele = document.getElementById('#example');
var bg = ele.style.backgroundColor;  
ele.style.filter = RGBATranslater(bg);  

If you only to get 16 binary color, you can set the colorOnly option to true, like so:

RGBATranslater(bg, true);  

Or if you only set the color to translate, you can use the translater core, like so:

var translaterCore = require('rgba-translater').translater;
var color = '255,255,255,0.9';
translaterCore(color); //return ccffffff;

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i rgba-translater

      Weekly Downloads

      0

      Version

      1.0.1

      License

      MIT

      Last publish

      Collaborators

      • idler_z