Socket
Socket
Sign inDemoInstall

color-name

Package Overview
Dependencies
0
Maintainers
3
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    color-name

A list of color names and its values


Version published
Maintainers
3
Install size
6.09 kB
Created

Package description

What is color-name?

The color-name npm package provides a list of color names and their corresponding hexadecimal color codes. It is a simple mapping of color names to their hex values, which can be useful for various applications where color names need to be converted to hex codes and vice versa.

What are color-name's main functionalities?

Get Hex Code by Color Name

This feature allows you to retrieve the RGB values of a color by providing its name as a key. The output is an array of RGB values.

"use strict";
const colorName = require('color-name');
console.log(colorName['red']); // Outputs: [255, 0, 0]

Check if Color Name Exists

This feature allows you to check if a color name exists within the package's mapping by checking if the key is defined.

"use strict";
const colorName = require('color-name');
console.log(colorName['rebeccapurple'] !== undefined); // Outputs: true

Other packages similar to color-name

Readme

Source

A JSON with color names and its values. Based on http://dev.w3.org/csswg/css-color/#named-colors.

NPM

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

Keywords

FAQs

Last updated on 08 Nov 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc