Socket
Socket
Sign inDemoInstall

chartjs-color-string

Package Overview
Dependencies
1
Maintainers
2
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    chartjs-color-string

Parser and generator for CSS color strings


Version published
Weekly downloads
673K
decreased by-18.09%
Maintainers
2
Install size
24.6 kB
Created
Weekly downloads
 

Readme

Source

chartjs-color-string

npm Travis

library for parsing and generating CSS color strings.

Install

With npm:

$ npm install color-string

Usage

Parsing

colorString.getRgb("blue")                       // [0, 0, 255]
colorString.getRgb("#FFF")                       // [255, 255, 255]
colorString.getRgba("#FFFA")                     //[255, 255, 255, 0.67]}
colorString.getRgba("#FFFFFFAA")                 // [255, 255, 255, 0.67]}

colorString.getRgba("rgba(200, 60, 60, 0.3)")    // [200, 60, 60, 0.3]
colorString.getRgba("rgb(200, 200, 200)")        // [200, 200, 200, 1]

colorString.getHsl("hsl(360, 100%, 50%)")        // [360, 100, 50]
colorString.getHsla("hsla(360, 60%, 50%, 0.4)")  // [360, 60, 50, 0.4]

colorString.getAlpha("rgba(200, 0, 12, 0.6)")    // 0.6

Generation

colorString.hexString([255, 255, 255])   // "#FFFFFF"
colorString.hexString([0, 0, 255, 0.4])    // "#0000FF66"
colorString.hexString([0, 0, 255], 0.4)    // "#0000FF66"
colorString.rgbString([255, 255, 255])   // "rgb(255, 255, 255)"
colorString.rgbString([0, 0, 255, 0.4])  // "rgba(0, 0, 255, 0.4)"
colorString.rgbString([0, 0, 255], 0.4)  // "rgba(0, 0, 255, 0.4)"
colorString.percentString([0, 0, 255])   // "rgb(0%, 0%, 100%)"
colorString.keyword([255, 255, 0])       // "yellow"
colorString.hslString([360, 100, 100])   // "hsl(360, 100%, 100%)"

Keywords

FAQs

Last updated on 07 Mar 2019

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