Check it
Find the nearest flat color for a RGB/Hex input.
$ npm i --save flat-colors
// Dependencies
var FlatColors = require("flat-colors")
// Get the flat red
console.log(FlatColors(255, 0, 0));
// => [211, 84, 0]
// Same thing, but using a rgb array
console.log(FlatColors([255, 0, 0]));
// => [211, 84, 0]
// Still same color but using hex color
console.log(FlatColors("#f00"));
// => [211, 84, 0]
// Random flat color
console.log(FlatColors());
// => [?, ?, ?]
Finds the nearest flat color for rgb and hex inputs.
- String|Number|Array
r
: The color as string in hex format, the red value or the rgb passed as array. Ifundefined
, a random color will be returned. - Number
g
: The green value. - Number
b
: The blue value.
- Array An array containing the rgb values of the flat color which was found.
Converts a hex format color into rgb.
- String
hex
: The color in the hex format.
- Array The rgb array or null.
Have an idea? Found a bug? See how to contribute.
The color values are taken from flatuicolors.com. 🎨
If you are using this library in one of your projects, add it in this list. ✨
color-it
—Flat colors for your Node.js strings.engine-builder
(by jillix)—Engine composition parser.gpm
—npm + git = gpm - Install NPM packages and dependencies from git repositories.