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

1.0.7 • Public • Published

colornames

Convert color names to HEX color values.

colornames-es

Installation

npm

$ npm install --save colornames-es

Example

import toHex from 'colornames';

VGA color names

toHex('red') // => "#FF0000"
toHex('blue') // => "#0000FF"

CSS color names

toHex('lightsalmon') // => "#FFA07A"
toHex('mediumvioletred') // => "#C71585"

Get meta data about a color

toHex.get('red')
// =>
{
  name: "red",
  css: true,
  value: "#FF0000",
  vga: true
}

Conversion is case-insensitive

toHex('Blue') // => "#0000FF"
toHex('BLUE') // => "#0000FF"
toHex('BlUe') // => "#0000FF"

API

colornames(name)

Get HEX code for a color name, or undefined if unknown.

.get(name)

All known data about color, including whether valid VGA or CSS color name.

.get.vga(name)

HEX code for a color name, only if the color is a valid VGA color name.

.get.css(name)

HEX code for a color name, only if the color is a valid CSS color name.

###.all() Get all color names data.

License

MIT

Complete Color Map

example-color-table-

Package Sidebar

Install

npm i colornames-es

Weekly Downloads

29

Version

1.0.7

License

MIT

Unpacked Size

233 kB

Total Files

9

Last publish

Collaborators

  • hdriel