JSPM

css-color-names-rgb

1.0.4
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 3
  • Score
    100M100P100Q37603F
  • License MIT

CSS color names in RGB format, from the spec.

Package Exports

  • css-color-names-rgb
  • css-color-names-rgb/dist/index.mjs

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (css-color-names-rgb) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

npm version Downloads Uses TypeScript

css-color-names-rgb

These are the CSS color names from the CSS spec, as numeric RGB values.

Does not include transparent or currentcolor.

All color names are lowercase. If needed, transform colors using myColor.toLowerCase() before passing.

This library is optimized for parsing using JSON.parse (See https://v8.dev/blog/cost-of-javascript-2019#json).

Example

import { cssColors } from 'css-color-names-rgb';

console.log(cssColors.papayawhip);
// [255, 239, 213]

Utilities

import {
  type ColorName,
  isCssColorName,
  getColor,
} from 'css-color-names-rgb';

Comparison with other libraries

  • color-name doesn't have types included (DT only), and doesn't use JSON.parse to optimize load time.
  • css-color-names doesn't have RGB values.
  • html-colors doesn't have RGB values.
  • css-spec-colors returns RGB values in the form of a CSS rgb() string.
  • named-css-colors calculates RGB values from hex, freezes objects, and includes extra utils.