Socket
Socket
Sign inDemoInstall

css-spec-colors

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

css-spec-colors

A JSON with all CSS color keywords and their corresponding values in hex, RGB and HSL. Color list generated from W3C spec (https://www.w3.org/TR/css-color-4/#named-colors).


Version published
Maintainers
1
Created
Source

css-spec-colors

A JSON with all CSS color keywords and their corresponding values in hex, RGB and HSL. Color list generated from W3C spec (https://www.w3.org/TR/css-color-4/#named-colors).

Install

Using npm:

$ npm install css-spec-colors

Using yarn:

$ yarn add css-spec-colors

Usage

import colors from 'css-spec-colors'; // or const colors = require('css-spec-colors');

// All colors
console.log(colors);

/**
 * {
 *   aliceblue: {
 *     name: 'aliceblue',
 *     hex: '#f0f8ff',
 *     rgb: 'rgb(240, 248, 255)',
 *     hsl: 'hsl(208, 100%, 97.1%)'
 *   },
 *   ...
 * }
 *
 */

// Get a color by name
console.log(colors['aliceblue']);

/**
 * {
 *   name: 'aliceblue',
 *   hex: '#f0f8ff',
 *   rgb: 'rgb(240, 248, 255)',
 *   hsl: 'hsl(208, 100%, 97.1%)'
 * }
 */

// Get the hex value of a color
console.log(colors['aliceblue'].hex); // '#ff0000'

// Get the RGB value of a color
console.log(colors['aliceblue'].rgb); // 'rgb(255, 0, 0)'

// Get the HSL value of a color
console.log(colors['aliceblue'].hsl); // 'hsl(0, 100%, 50%)'

Colors are sorted alphabetically.

License

MIT © Aarón García

Keywords

FAQs

Package last updated on 23 Mar 2020

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc