Socket
Socket
Sign inDemoInstall

colornames

Package Overview
Dependencies
0
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    colornames

Map color names to HEX color values.


Version published
Weekly downloads
651K
decreased by-13.67%
Maintainers
1
Install size
43.6 kB
Created
Weekly downloads
 

Readme

Source

colornames

Convert color names to HEX color values.

NPM

Build Status Dependency Status

Installation

Component

$ component install timoxley/colornames

Node/Browserify

$ npm install colornames

Example

var toHex = require('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-

Keywords

FAQs

Last updated on 24 Jan 2016

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