npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

colors-named

v1.0.2

Published

A array with color names.

Downloads

96,178

Readme

colors-named

Buy me a coffee Build & Deploy Open in unpkg npm version Coverage Status

A array with color names. Based on https://www.w3.org/TR/css-color-4/#named-colors

Installation

This package is ESM only: Node 12+ is needed to use it and it must be import instead of require.

npm install colors-named

If you still want to use in CommonJS, you can use dynamic import() to load.

const named = await import('colors-named');

// Fix compiling in typescript.
// https://github.com/microsoft/TypeScript/issues/43329#issuecomment-922544562
const named = await (Function('return import("colors-named")')()) as Promise<typeof import("colors-named")>;

Usage

import named from "colors-named";

console.log(named)                   // => ['aliceblue', 'antiquewhite', 'aqua', ... ]
console.log(named.includes('red'))   // => true
console.log(named.length)            // => 148
'colors-named'                'colors-named-hex'          'colors-named-decimal'
===============              ===================         =====================
const named = [                const hexs = [             const hexs = [
  'aliceblue',         ->        '#F0F8FF',       ->        [240, 248, 255],
  'antiquewhite',      ->        '#FAEBD7',       ->        [250, 235, 215],
  'aqua',              ->        '#00FFFF',       ->        [0, 255, 255],
  'aquamarine',        ->        '#7FFFD4',       ->        [127, 255, 212],
  'azure',             ->        '#F0FFFF',       ->        [240, 255, 255],
  'beige',             ->        '#F5F5DC',       ->        [245, 245, 220],
  'bisque',            ->        '#FFE4C4',       ->        [255, 228, 196],
  'black',             ->        '#000000',       ->        [0, 0, 0],
  'blanchedalmond',    ->        '#FFEBCD',       ->        [255, 235, 205],
  'blue',              ->        '#0000FF',       ->        [0, 0, 255],
  'blueviolet',        ->        '#8A2BE2',       ->        [138, 43, 226],
  'brown',             ->        '#A52A2A',       ->        [165, 42, 42],
  ...                  ->        ...              ->        ...
];                             ];                         ];
import hexs from "colors-named-hex";
import named from "colors-named";
import decimal from "colors-named-decimal";

decimal[named.indexOf('aliceblue')] // => [240, 248, 255]
decimal[named.indexOf('red')]       // => [255, 0, 0]
decimal[named.indexOf('black')]     // => [0, 0, 0]

hexs[named.indexOf('aliceblue')] // => #F0F8FF
hexs[named.indexOf('red')]       // => #FF0000
hexs[named.indexOf('black')]     // => #000000

API

/**
 * A array with color names. Based on https://www.w3.org/TR/css-color-4/#named-colors
 */
declare const names: readonly ["aliceblue", "antiquewhite", "aqua", "aquamarine", "azure", "beige", "bisque", "black", "blanchedalmond", "blue", "blueviolet", "brown", "burlywood", "cadetblue", "chartreuse", "chocolate", "coral", "cornflowerblue", "cornsilk", "crimson", "cyan", "darkblue", "darkcyan", "darkgoldenrod", "darkgray", "darkgreen", "darkgrey", "darkkhaki", "darkmagenta", "darkolivegreen", "darkorange", "darkorchid", "darkred", "darksalmon", "darkseagreen", "darkslateblue", "darkslategray", "darkslategrey", "darkturquoise", "darkviolet", "deeppink", "deepskyblue", "dimgray", "dimgrey", "dodgerblue", "firebrick", "floralwhite", "forestgreen", "fuchsia", "gainsboro", "ghostwhite", "gold", "goldenrod", "gray", "green", "greenyellow", "grey", "honeydew", "hotpink", "indianred", "indigo", "ivory", "khaki", "lavender", "lavenderblush", "lawngreen", "lemonchiffon", "lightblue", "lightcoral", "lightcyan", "lightgoldenrodyellow", "lightgray", "lightgreen", "lightgrey", "lightpink", "lightsalmon", "lightseagreen", "lightskyblue", "lightslategray", "lightslategrey", "lightsteelblue", "lightyellow", "lime", "limegreen", "linen", "magenta", "maroon", "mediumaquamarine", "mediumblue", "mediumorchid", "mediumpurple", "mediumseagreen", "mediumslateblue", "mediumspringgreen", "mediumturquoise", "mediumvioletred", "midnightblue", "mintcream", "mistyrose", "moccasin", "navajowhite", "navy", "oldlace", "olive", "olivedrab", "orange", "orangered", "orchid", "palegoldenrod", "palegreen", "paleturquoise", "palevioletred", "papayawhip", "peachpuff", "peru", "pink", "plum", "powderblue", "purple", "rebeccapurple", "red", "rosybrown", "royalblue", "saddlebrown", "salmon", "sandybrown", "seagreen", "seashell", "sienna", "silver", "skyblue", "slateblue", "slategray", "slategrey", "snow", "springgreen", "steelblue", "tan", "teal", "thistle", "tomato", "turquoise", "violet", "wheat", "white", "whitesmoke", "yellow", "yellowgreen"];
export default names;

Related

Contributors

As always, thanks to our amazing contributors!

Made with action-contributors.

License

Licensed under the MIT License.