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

tinycolor2

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

tinycolor2

Fast Color Parsing and Manipulation

  • 1.6.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created

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

Package last updated on 03 Feb 2023

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