Socket
Socket
Sign inDemoInstall

culori

Package Overview
Dependencies
0
Maintainers
3
Versions
256
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

culori


Version published
Weekly downloads
174K
decreased by-7.74%
Maintainers
3
Install size
768 kB
Created
Weekly downloads
 

Package description

What is culori?

The 'culori' npm package is a comprehensive color library for JavaScript that provides a wide range of functionalities for color manipulation, conversion, and analysis. It supports various color spaces and formats, making it a versatile tool for developers working with colors in web development, data visualization, and other applications.

What are culori's main functionalities?

Color Conversion

This feature allows you to convert colors between different color spaces. In the example, an RGB color is converted to the LAB color space.

const culori = require('culori');
const rgbColor = culori.rgb('#ff0000');
const labColor = culori.lab(rgbColor);
console.log(labColor);

Color Manipulation

This feature provides functions to manipulate colors, such as lightening or darkening them. The example demonstrates how to lighten an HSL color.

const culori = require('culori');
const color = culori.hsl({ h: 0, s: 1, l: 0.5 });
const lighterColor = culori.lighten(color, 0.2);
console.log(lighterColor);

Color Parsing

This feature allows you to parse color strings into color objects. The example shows how to parse a hex color string into an RGB color object.

const culori = require('culori');
const color = culori.parse('#ff0000');
console.log(color);

Color Interpolation

This feature enables color interpolation between two or more colors. The example demonstrates how to find a color that is halfway between red and blue.

const culori = require('culori');
const interpolate = culori.interpolate(['#ff0000', '#0000ff']);
const midColor = interpolate(0.5);
console.log(midColor);

Color Difference

This feature allows you to calculate the difference between two colors. The example shows how to compute the Euclidean difference between red and green colors.

const culori = require('culori');
const color1 = culori.rgb('#ff0000');
const color2 = culori.rgb('#00ff00');
const difference = culori.differenceEuclidean(color1, color2);
console.log(difference);

Other packages similar to culori

Readme

Source

culori

npm version bundle size

Culori is a comprehensive color library for JavaScript that works across many color spaces to offer conversion, interpolation, color difference formulas, blending functions, and more. It provides up-to-date support for the color spaces defined in CSS Color Module Level 4 specification.

npm install culori

The full documentation is published on culorijs.org. Some quick entry points:

Contributing

Contributions of any kind (feedback, ideas, bug fixes) are welcome. Please open a GitHub issue before starting work on anything that's not straightforward.

Keywords

FAQs

Last updated on 05 Dec 2021

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc