Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

color-parse

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

color-parse

Color string parser

  • 1.3.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
328K
decreased by-50.05%
Maintainers
1
Weekly downloads
 
Created
Source

color-parse Build Status

Fast and tiny color string parser.

$ npm install color-parse

var parse = require('color-parse');
parse('hsla(12, 10%, 50%, .3)'); //{ space: 'hsl', values: [12, 10, 50], alpha: 0.3 }

Parsed strings

  • red, see color-name
  • rgb(10, 20, 30), rgba(10, 20, 30, .3)
  • hsl(), hsla() inc. named hues
  • hwb()
  • cmyk()
  • xyz()
  • lab()
  • lch()
  • luv()
  • #RGB
  • #RGBA
  • #RRGGBB
  • #RRGGBBAA
  • R:10 G:20 B:30
  • (R10 / G20 / B30)
  • C100/M80/Y0/K35

Parsed not strings

  • [10, 20, 20] as red, green and blue channels
  • {r: 10, g: 20, b: 30}
  • {red: 10, green: 20, blue: 30}
  • {h: 10, s: 20, l: 30}
  • 0xrrggbb numbers

Not parsed strings

  • 'yellowblue' returns null
  • color-space — collection of color space conversions.
  • color-rgba — convert any color string to rgba array.
  • color-alpha — change alpha component of any color.

Analogs

  • parse-color — parser by James Halliday. Initially inspired by that awesome parser. It performs calculations to every possible space which results in bloated size of lib.
  • color-parser — parser by TJ. Supports limited set of spaces.
  • color-string — color parsing/serializing module by Heather Arthur. Has extensive API for parsing and serializing from any to any space.

NPM

Keywords

FAQs

Package last updated on 19 Jul 2017

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc