Tolga1452 / color-converter.js

A simple color convert tool for Node.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

color-converter.js

A simple color convert tool for Node.js

Currently supports Decimal, Hexadecimal and RGB colors.

Installation

npm install @tolga1452/color-converter.js

Usage

Converting Decimal Colors

const Color = require('@tolga1452/color-converter.js');

var color = new Color(1357567);

console.log(color.hex); //Output => "#0f7fbf"
console.log(color.rgb); //Output => [ 20, 182, 255 ]

Converting Hexadecimal Colors

const Color = require('@tolga1452/color-converter.js');

var color = new Color("#0f7fbf");

console.log(color.decimal); //Output => 1357567
console.log(color.rgb); //Output => [ 20, 182, 255 ]

Converting RGB Colors

const Color = require('@tolga1452/color-converter.js');

var color = new Color([ 20, 182, 255 ]);

console.log(color.hex); //Output => "#0f7fbf"
console.log(color.decimal); //Output => 1357567

Bug Reports & Feedbacks

Please create new issue on GitHub for any feedback or bug reports

About

A simple color convert tool for Node.js

License:MIT License


Languages

Language:JavaScript 100.0%