Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/justinidlerz/rgbatranslater
To translate rgba color to 16 binary model.
https://github.com/justinidlerz/rgbatranslater
Last synced: 16 days ago
JSON representation
To translate rgba color to 16 binary model.
- Host: GitHub
- URL: https://github.com/justinidlerz/rgbatranslater
- Owner: Justinidlerz
- Created: 2016-09-11T16:20:22.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2016-09-11T16:40:57.000Z (about 8 years ago)
- Last Synced: 2024-10-20T12:50:57.087Z (19 days ago)
- Language: JavaScript
- Size: 1.95 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
#RGBA translater
To translate rgba to 16 binary model#Usage:
```javascript
npm install rgba-translater
```Use to translate backgroundColor to compatible ie8
```javascript
//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:
```javascript
RGBATranslater(bg, true);
```Or if you only set the color to translate, you can use the translater core, like so:
```javascript
var translaterCore = require('rgba-translater').translater;
var color = '255,255,255,0.9';
translaterCore(color); //return ccffffff;
```