Skip to content

A tiny (565 B) JavaScript library to generate permanent color from any string, array or object.

License

Notifications You must be signed in to change notification settings

stuneak/create-color

Repository files navigation

Create color

npm version

A tiny (565 B) JavaScript library to generate permanent color from any string, array or object.

DEMO. Open in CodeSandbox

Install

npm install create-color
// or
yarn add create-color

Usage

const createColor = require("create-color");
// or
import createColor from "create-color";
// format by default: hex
const hex = createColor("canThereBeAnyText"); // => "#67cb22"
// from string
const hsl = createColor("canThereBeAnyText", { format: "hsl" }); // => "hsl(96,71%,46%)"

// from object
const hex = createColor(
  { name: "Andrey", age: 27, role: "user" },
  { format: "hex" }
); // => "#f6555d"

// from array
const rgb = createColor(["random", "color", "generation"], { format: "rgb" }); // => "rgb(218,179,136)"

About

A tiny (565 B) JavaScript library to generate permanent color from any string, array or object.

Topics

Resources

License

Stars

Watchers

Forks

Packages