1.0.0 • Published 4 years ago
@eodomius/colors v1.0.0
Eodomius utilities : Colors
This module contains useful functions for manipulate colors and have colors in node.js console.
Installation
NPM:
npm i @eodomius/colorsYarn:
yarn add @eodomius/colorsImportation
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 #ffffffColors
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)");1.0.0
4 years ago