1.0.4 • Published 4 years ago

js-colors v1.0.4

Weekly downloads
-
License
MIT
Repository
-
Last release
4 years ago

JS-Colors

  • Color in JS

Example usage

Get data from a color rgb

import { Color } from "js-colors"; // Or const { Color } = require("js-colors")

let blue = new Color(0, 0, 255); // input can be a number or a hex string or a rgb

console.log(blue.name); // blue
console.log(blue.hex); // #0000ff
console.log(blue.rgb); // [0, 0, 255]
console.log(blue.colorNumber); // 255

Get data from a color name

import { Color } from "js-colors"; // Or const { Color } = require("js-colors")

let blue = new Color("blue"); // input can be a number or a hex string or a rgb

console.log(blue.name); // blue
console.log(blue.hex); // #0000ff
console.log(blue.rgb); // [0, 0, 255]
console.log(blue.colorNumber); // 255

Get data from a color number

import { Color } from "js-colors"; // Or const { Color } = require("js-colors")

let blue = new Color(255); // input can be a number or a hex string or a rgb

console.log(blue.name); // blue
console.log(blue.hex); // #0000ff
console.log(blue.rgb); // [0, 0, 255]
console.log(blue.colorNumber); // 255
1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago