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

colorizr

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

colorizr

Manipulate colors like a boss

  • 1.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
439
decreased by-32.04%
Maintainers
1
Weekly downloads
 
Created
Source

Colorizr

NPM version build status Maintainability Test Coverage

JavaScript module to manipulate colors, get its properties and compare it with another color following the WCAG 2.0.

Setup

Install

npm install --save colorizr

And import it:

import Colorizr from 'Colorizr';

Usage

const colorizr = new Colorizr('#ff0044');

colorizr.hex // #ff0044
colorizr.hsl // { h: 344, s: 100, l: 50 };
colorizr.rgb // { r: 255, g: 0, b: 68 };

colorizr.saturate(20);
colorizr.lighten(10);

API

Set the instance color.
colorizr.setColor(color: string | Array | Object)

Getters
colorizr.hue // 0-360
colorizr.saturation // 0-100
colorizr.lightness // 0-100
colorizr.red // 0-255
colorizr.green // 0-255
colorizr.blue // 0-255
colorizr.luminance // 0-1
colorizr.chroma // 0-1
Manipulation

Increase lightness.
colorizr.lighten(percentage: number = 10)

Decrease lightness.
colorizr.darken(percentage: number = 10)

Increase saturation.
colorizr.saturate(percentage: number = 10)

Decrease saturation.
colorizr.saturate(percentage: number = 10)

References

calculating-color-contrast
Colour Contrast Check
Contrast Checker

Keywords

FAQs

Package last updated on 08 Dec 2018

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