Skip to content

🎨 A list of all CSS color keywords and their corresponding values in hex, RGB and HSL. Color list scrapped from W3C spec.

License

Notifications You must be signed in to change notification settings

aarongarciah/css-spec-colors

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🎨 css-spec-colors

npm code style: prettier Known Vulnerabilities Netlify Status

A JSON with all CSS color keywords and their corresponding values in hex, RGB and HSL.

The color list is generating by scrapping the W3C spec (https://www.w3.org/TR/css-color-4/#named-colors).

Install

Using npm:

$ npm install css-spec-colors

Or yarn:

$ yarn add css-spec-colors

You can also download the JSON file directly from unpkg or Netlify without installing any dependency.

Usage

Colors are sorted alphabetically

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%)'
  },
  antiquewhite: {
    name: 'antiquewhite',
    hex: '#faebd7',
    rgb: 'rgb(250, 235, 215)',
    hsl: 'hsl(34, 77.8%, 91.2%)'
  }
  ...
}
*/

// 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%)'

License

MIT


Made with ♥️ by Aarón García Hervás

About

🎨 A list of all CSS color keywords and their corresponding values in hex, RGB and HSL. Color list scrapped from W3C spec.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published