Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

webcolors

zzzaim479MIT2.0.1

Color palettes

readme

webcolors

All the colors of the web

Palettes

Formats

Installation

$ npm install webcolors

With CSS custom properties

Use a CSS preprocessor such ass PostCSS to handle @import syntax.

@import "webcolors/material/index.css";

body {
  color: --red;
  background: --yellow;
}

With SCSS

Use sass to handle @import syntax. The format of the import file path depends on your configuration.

@import "~webcolors/material/index.css";

body {
  color: $red;
  background: $yellow;
}

With LESS

Install and configure Less.js.

@import "node_modules/webcolors/flatui/index";

body {
  color: @red;
  background: @blue;
}

With Stylus

Install and configure Stylus.

@import "node_modules/webcolors/mrmrs";

body {
  color: orange;
  background: white;
}

With JavaScript or JSON

Colors can be imported directly from Node.js scripts or modules.

// All palettes:
const webcolors = require("webcolors");

// Specific palettes:
const bootstrap = require("webcolors/bootstrap");
const material = require("webcolors/material");

console.log(`FlatUI yellow: ${webcolors.flatui.yellow}`);
console.log(`Bootstrap red: ${bootstrap.red}`);
console.log(`Material blue: ${material.blue}`);

Palettes pre-exported as JSON files can be found in the package's palette directories.

Changelog

1.2.2 - Fix typo in Material palette for "olive" color.

1.2.0 - Add plain, non-number-prefixed Material color aliases, e.g. cyan => cyan500, indigo => indigo500, etc.

1.1.0 - All color values are normalized as uppercase hex strings.

1.0.0 - Breaking change to directory structure. No more dist folder, individual palettes are available at root directory.

Inspiration

Inspired by the material-colors and mrmrs-colors packages.

License

MIT - see LICENSE file.

changelog

Changelog

All notable changes to this project will be documented in this file. See standard-version for commit guidelines.

2.0.1 (2020-03-02)

Bug Fixes

  • correctly include webcolors package files (4cd1e48)

2.0.0 (2020-03-02)

⚠ BREAKING CHANGES

  • Material palette now uses external material-ui-colors npm package to source its colors.
  • drop color-* prefix in variable names.
  • this package will no longer be published to bower

Features

  • add more flatui palette schemes (04565a6)
  • add new "bootstrap" color palette (fixes #3) (3fefce0)
  • add new "bulma" color palette (fixes #4) (eb54e6c)
  • add TailwindCSS color palette (a62d1ca)
  • drop support for bower (5a76e37)
  • palette scripts can now export functions (81327c0)
  • use colors.css package as source (9b5f3f7)
  • use material-ui-colors package as source (5a29d16)

Bug Fixes

  • add index.js package.json targets in Makefile (d0640e2)
  • add missing flatui/*.js files (0d03b3b)
  • add proper color value for material.fuchsia (d763971)
  • proper normalization of colors (047e515)
  • require path in bootstrap bulma src (3a0bfdf)
  • syntax error in .eslintrc.js (23193b2)
  • use default CSS keywords for undefined colors (e92a94d)
  • use make and mustache for build chain (925ce0e)