everycolor
TypeScript icon, indicating that this package has built-in type declarations

1.0.0-alpha.2 • Public • Published

everycolor

This package gives a unique name to every single color in the sRGB namespace.

Usage

import { fromRGB, toRGB } from "everycolor";

console.log(fromRGB(255, 0, 0)); // "red"
console.log(fromRGB(255, 128, 128)); // "redhalfwhite"

console.log(toRGB("red")); // { r: 255, g: 0, b: 0 };
console.log(toRGB("readhalfwhite")); // { r: 255, g: 128, b: 128 }

fromRGB

Converts given color to a color name. Throws if invalid value is passed.

toRGB

Converts given color to RGB values. Returns undefined if unknown name is passed.

Note: until the release of 1.0.0, color names may be changed.

PostCSS Plugin

This package also provides a PostCSS plugin. Example postcss.config.js configuration:

module.exports = {
  plugins: [require("everycolor/postcss")],
};

Then you can use everycolor colors in your CSS:

a {
  color: bluetealsomewhatlittleimperceptibleaquasomewhatlittleimperceptibleinfinitesimalwhite;
}

Wow, nice!

Contributing

Welcome

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i everycolor

Weekly Downloads

2

Version

1.0.0-alpha.2

License

MIT

Unpacked Size

78.7 kB

Total Files

55

Last publish

Collaborators

  • uhyo