Socket
Socket
Sign inDemoInstall

css-color-l4

Package Overview
Dependencies
2
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    css-color-l4

CSS Color Module Level 4-compliant color string parser


Version published
Weekly downloads
37
decreased by-5.13%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

css-color-l4

npm version test coverage GitHub Workflow Status

CSS Color Module Level 4-compliant color string parser

(forked from adroitwhiz/css-color and translated to TypeScript)

css-color-l4 is a CSS Color Module Level 4-compliant CSS color value parser. It parses any color values defined in the CSS Color Module Level 4, and refuses to parse any other values. This is to ensure complete consistency with, for instance, web browsers. In comparison, most other JS color parsers both fail to parse color values that browsers will accept.

Key points:

  • this library is well tested around edge cases
  • this library doesn't include any color conversion functionality

Limitations

  • The color() function syntax is currently not supported.
  • currentcolor is currently not supported.
  • System colors (i.e. like VisitedText) are currently not supported. (Named colors like red are supported)

Usage

The parser function is the default export:

const parseColor = require('css-color')

Installation

npm install css-color-l4 --save
# yarn add css-color-l4

Alternatively, there are also client web builds available:

<!-- Dependencies -->

<!-- window.CSSColor -->
<script src="https://unpkg.com/css-color-l4/dist/css-color-l4.umd.js"></script>

Documentation

License

MIT

Keywords

FAQs

Last updated on 02 Apr 2021

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc