Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

colors-list

ADITYABHAVAR1710CODER AB1.0.1

A list of color names and its values

color, color-name, color-list, color-name-list, colorname, colorlist, color-keyword, keyword

readme

colors-list

A comprehensive list of color names with their corresponding RGB values.

Installation

To install the package, use npm:

npm install colors-list

Usage

This package provides an easy-to-use interface for accessing color names and their RGB values.

Example

Code

import assert from 'node:assert';
import colorNameList from './index.js';

// Function to get RGB value by color name
function getColorByName(colorName) {
    return colorNameList[colorName.toLowerCase()] || null;
}


// Example usage
console.log(getColorByName('blue')); // [0, 0, 255]
console.log(getColorByName('red')); // [255, 0, 0]
console.log(getColorByName('unknownColor')); // null

ES Module

import colorNameList from 'colors-list';

// Access RGB values using color names
console.log(colorNameList.red); // [255, 0, 0]
console.log(colorNameList.aliceblue); // [240, 248, 255]

Example Code

import colors from 'colors-list';
colors.red //[255,0,0]

CommonJS Module

If you need to use this package in a CommonJS environment, you can dynamically import the module:

(async () => {
  const colorNameList = await import('colors-list');

  // Access RGB values using color names
  console.log(colorNameList.default.red); // [255, 0, 0]
  console.log(colorNameList.default.aliceblue); // [240, 248, 255]);
})();

Contributing

Feel free to contribute by opening issues or submitting pull requests.

Contact

For any issues or questions, please visit the GitHub Issues page.

Author

Aditya Bhavar