GithubHelp home page GithubHelp logo

radiovisual / html-colors Goto Github PK

View Code? Open in Web Editor NEW
9.0 2.0 8.0 80 KB

Get a list of all the HTML and CSS color names and their hex values.

License: MIT License

JavaScript 100.00%
html-color html-colors color

html-colors's Introduction

html-colors Build Status

Get a list of all the HTML and CSS color names and their hex values.

The color list is just a JSON file and can be used wherever.

Install

$ npm install --save html-colors

Usage

const htmlColors = require('html-colors');

// Get an object with all color names and hex values
htmlColors.all();
//=> { lightgreen: '#90EE90', mediumpurple: '#9370DB', ... }

// Get an array of all the color names
htmlColors.names();
//=> [ 'lightgreen', 'mediumpurple', 'darkviolet', ... ]

// Get the hex color from a color name
htmlColors.hex('pink');
//=> '#FFC0CB'

// Get a random HTML color name
htmlColors.random();
//=> 'antiquewhite'

API

.all()

Get an object with all the HTML color names and their HEX values.

htmlColors.all();
//=> { lightgreen: '#90EE90', mediumpurple: '#9370DB', ... }

.names()

Get an array with all the HTML color names.

htmlColors.names();
//=> [ 'lightgreen', 'mediumpurple', 'darkviolet', ... ]

.hex(colorname)

Get the hexadecimal color code from a color name.

Input Type: string

htmlColors.hex('hotpink');
//=> '#FF69B4'

.random()

Get a random HTML color name string.

htmlColors.random();
//=> 'peachpuff'

Contributions

Please feel free to open an issue or send a pull request. Contributions are always welcome.

License

MIT © Michael Wuergler

html-colors's People

Contributors

chrishein avatar radiovisual avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

html-colors's Issues

build breaks with webpack.js

When building project that imports html-colors using Webpack.js, build fails at

const htmlColors = require('./html-colors');

Webpack is expecting js module.

To fix that, .json extension is needed to be specified.

const htmlColors = require('./html-colors.json');

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.