New:Introducing Socket Scanning for VS Code Marketplace Extensions.Learn more →
Get Started

get-colors-from-string

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

get-colors-from-string

Get colors from string

latest
Source
npmnpm
Version
0.1.2
Version published
Maintainers
1
Created
Source

Get colors from string

Get colors from string, supported color styles:

  • Regular HEX color: #000, #f2f2f2
  • rgb, rgba, hsl, hsla: rga(120, 120, 120), hsla(240,100%,50%,0.05)
  • Named color: red, yellow

Getting Started

npm install get-colors-from-string --save

Usage

import getColorsFromString from 'get-colors-from-string';

const exampleString = `
body {
  background: white;
  color: #333;
}

h1 {
  background: rgba(0, 0, 0, 0.3);
  color: #333;
}
`;

console.log(getColorsFromString(exampleString));
// [ "#333", "rgba(0, 0, 0, 0.3)", "white" ]

FAQs

Package last updated on 30 Jun 2017

Related posts