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

@ctrl/tinycolor

Package Overview
Dependencies
Maintainers
1
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ctrl/tinycolor

Fast, small color manipulation and conversion for JavaScript

  • 4.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.4M
decreased by-28.57%
Maintainers
1
Weekly downloads
 
Created

What is @ctrl/tinycolor?

The @ctrl/tinycolor npm package is a comprehensive tool for color manipulation and conversion. It allows users to perform a variety of operations on colors, including parsing colors in different formats, converting between color models (e.g., RGB, HSL, HSV), and manipulating colors (e.g., lighten, darken, saturate).

What are @ctrl/tinycolor's main functionalities?

Color Parsing

This feature allows the parsing of colors from strings in various formats, including HEX, RGB, RGBA, HSL, HSLA, etc. The code sample demonstrates how to parse a color from a HEX string and an RGBA string.

"const tinycolor = require('@ctrl/tinycolor');\nconst color1 = tinycolor('#f00');\nconst color2 = tinycolor('rgba(255, 0, 0, 0.5)');"

Color Conversion

This feature enables the conversion of colors between different models and formats. The code sample shows how to convert a named color ('red') to its HSV representation and then to an RGB string.

"const tinycolor = require('@ctrl/tinycolor');\nconst color = tinycolor('red');\nconst hsvColor = color.toHsv();\nconst rgbString = color.toRgbString();"

Color Manipulation

This feature provides methods to manipulate colors, such as lightening, darkening, and desaturating. The code sample demonstrates how to lighten and desaturate a color.

"const tinycolor = require('@ctrl/tinycolor');\nconst color = tinycolor('red');\nconst lighterColor = color.lighten().toString();\nconst desaturatedColor = color.desaturate().toString();"

Other packages similar to @ctrl/tinycolor

Keywords

FAQs

Package last updated on 13 Apr 2024

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