@eodomius/colors
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

Eodomius utilities : Colors

This module contains useful functions for manipulate colors and have colors in node.js console.

Installation

NPM:

npm i @eodomius/colors

Yarn:

yarn add @eodomius/colors

Importation

CommonJS:

const { ColorsConverter, ResolveColor } = require("@eodomius/colors");

EcmaScript modules:

import { ColorsConverter, ResolveColor } from "@eodomius/colors";

Convert colors

convertHexToRGB

Convert hexadecimal color code to RGB color code

Params

  • hexColor : Hexidecimal color code string

Return :

  • RGB color code Object
ColorsConverter.convertHexToRGB("#fff"); // Output {r:255, g:255, b:255}

convertRGBToHex

Convert RGB color code to hexadecimal color code

Params

  • RGB : RGB color code Object

Return :

  • RGB color code Object
ColorsConverter.convertHexToRGB({ r: 255, g: 255, b: 255 }); // Output #ffffff

Colors

find

Find a color by name, hex code, RGB code

Params

  • arg : The argument string
  • Options : The options Object

Return :

  • Color Object
ResolveColor.find("Orange", { limit: 1, sortBy: "name" });

findByName

Find a color by name, hex code, RGB code

Params

  • arg : The argument string
  • Options : The options Object

Return :

  • Color Object
ResolveColor.findByName("Orange");

findByHex

Find a color by hex code

Params

  • arg : The argument string
  • Options : The options Object

Return :

  • Color Object
ResolveColor.findByHex("#fff");

findByRGB

Find a color by RGB code

Params

  • arg : The argument string
  • Options : The options Object

Return :

  • Color Object
ResolveColor.findByRGB("(255, 255, 255)");

Package Sidebar

Install

npm i @eodomius/colors

Weekly Downloads

0

Version

1.0.0

License

Apache-2.0 License

Unpacked Size

36.7 kB

Total Files

18

Last publish

Collaborators

  • smaug-6739