Security News
New Proposed CISA Mandate Would Require Critical Infrastructure to Report Ransom Payments Within 24 Hours
CISA has proposed a set of new rules that would require critical infrastructure to report cyber incidents and ransom payments.
css-color-names
Advanced tools
A JSON Object of css color names mapped to their hex value
Weekly downloads
Package description
The css-color-names npm package provides a JSON object where the keys are CSS color names and the values are their corresponding hexadecimal color codes. It is a simple utility that can be used to convert CSS color names to hex codes and vice versa, facilitating developers in handling color names within their projects.
Convert CSS color name to hex code
This feature allows you to retrieve the hexadecimal code of a CSS color name by accessing the value associated with the color name key in the css-color-names object.
"const cssColorNames = require('css-color-names');
console.log(cssColorNames['tomato']); // Outputs: '#ff6347'"
Check if a color name is valid
This demonstrates how to check if a given string is a valid CSS color name by checking if it is a key in the css-color-names object.
"const cssColorNames = require('css-color-names');
console.log('rebeccapurple' in cssColorNames); // Outputs: true"
The color-name package provides an array of CSS color names and their RGB values. It is similar to css-color-names but focuses on RGB values instead of hex codes, making it useful for projects that work with RGB color models.
color-convert is a comprehensive color conversion library that supports conversions between various color models (e.g., RGB, HEX, HSL, etc.). While it offers much more than css-color-names in terms of functionality, it can also be used to convert CSS color names to other formats, making it a more versatile but complex alternative.
Readme
A JSON Object of css color names mapped to their hex value
var csscolors = require('css-color-names');
console.dir(csscolors);
yields
{
"aqua": "#00ffff",
"aliceblue": "#f0f8ff",
"antiquewhite": "#faebd7",
"black": "#000000",
"blue": "#0000ff",
...
}
In the Makefile you'll see a line like this:
./getcolors.sh | ./stringify.js > $(FILE)
The first command scrapes a site for the list,
and outputs the results separated by newlines. The
second command creates the JSON object and outputs
it to stdout, which then gets redirected into
css-color-names.json
npm install css-color-names
MIT
FAQs
A JSON Object of css color names mapped to their hex value
The npm package css-color-names receives a total of 2,771,001 weekly downloads. As such, css-color-names popularity was classified as popular.
We found that css-color-names demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISA has proposed a set of new rules that would require critical infrastructure to report cyber incidents and ransom payments.
Security News
Redis is no longer OSS, breaking its explicit commitment to remain under the BSD 3-Clause License forever. This has angered contributors who are now working to fork the software.
Product
Socket AI now enables 'AI detected potential malware' alerts by default, ensuring users benefit from AI-powered state-of-the-art malware detection without needing to opt-in.