Socket
Socket
Sign inDemoInstall

tinycolor2

Package Overview
Dependencies
0
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    tinycolor2

Fast Color Parsing and Manipulation


Version published
Weekly downloads
3.6M
decreased by-18.61%
Maintainers
1
Install size
181 kB
Created
Weekly downloads
 

Package description

What is tinycolor2?

The tinycolor2 npm package is a small, fast library for color manipulation and conversion in JavaScript. It allows for reading, editing, and converting colors between various color formats, as well as checking color properties and performing adjustments.

What are tinycolor2's main functionalities?

Color Parsing

Parse a string input to create a tinycolor instance. It accepts various color formats like HEX, RGB, HSL, HSV, and names.

var tinycolor = require('tinycolor2');
var color = tinycolor('#f0e');

Color Manipulation

Manipulate colors by chaining methods like lighten, darken, saturate, desaturate, etc., and then output to a desired format.

var newColor = tinycolor('red').lighten(10).desaturate(5).toHexString();

Color Comparison

Check readability and contrast between two colors to ensure that text is readable on a given background color.

var isReadable = tinycolor.isReadable('#000', '#fff');

Color Validation

Validate a color to check if it is a proper color that can be parsed and manipulated.

var isValid = tinycolor('red').isValid();

Color Conversion

Convert colors to different formats like RGB, HEX, HSL, HSV, etc.

var rgbString = tinycolor('red').toRgbString();

Other packages similar to tinycolor2

Keywords

FAQs

Last updated on 21 Dec 2022

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