node package manager
Easy collaboration. Discover, share, and reuse code in your team. Create a free org ยป

colornamer

colornamer

A simple npm module/js client library that gives back the color-name of a hex or rgb value.

Created to provide accessible color names to people that are blind and visually impaired as part of the p5 accessible canvas project (https://github.com/MathuraMG/p5-interceptor) for the p5.js web editor (https://github.com/processing/p5.js-web-editor).

NPM module

For use with Node.js: npm install colornamer

var color = require('colornamer');

color.rgbColorName(255,0,0); //returns red
color.hexColorName('ff0000'); //returns red

Client library

Link your html to the library: https://cdn.rawgit.com/lm-n/colour-namer/1228bc4d/lib/colorNamer.js
Use the following functions to get a color name:
rgbColorName(255,0,0); //returns red the expected input is three ints
hexColorName('ff0000'); //returns red the expected input is a string of six characters without "#" at the beginning