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

@types/chroma-js

Package Overview
Dependencies
Maintainers
1
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/chroma-js

TypeScript definitions for chroma-js

  • 2.4.5
  • ts5.0
  • ts5.1
  • ts5.2
  • ts5.3
  • ts5.4
  • ts5.5
  • ts5.6
  • ts5.7
  • ts5.8
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created

What is @types/chroma-js?

@types/chroma-js provides TypeScript type definitions for the chroma-js library, which is a JavaScript library for color conversions and color scales.

What are @types/chroma-js's main functionalities?

Color Conversion

This feature allows you to convert colors between different formats. In this example, the color 'red' is converted to its RGB representation.

const chroma = require('chroma-js');
const rgb = chroma('red').rgb();
console.log(rgb); // [255, 0, 0]

Color Scales

This feature allows you to create color scales. In this example, a scale from white to black is created and the color at the midpoint (0.5) is retrieved in hex format.

const chroma = require('chroma-js');
const scale = chroma.scale(['white', 'black']).mode('lab');
console.log(scale(0.5).hex()); // #777777

Color Manipulation

This feature allows you to manipulate colors. In this example, the color 'red' is darkened and the resulting color is retrieved in hex format.

const chroma = require('chroma-js');
const darkened = chroma('red').darken().hex();
console.log(darkened); // #8b0000

Color Blending

This feature allows you to blend two colors using different blending modes. In this example, 'red' and 'blue' are blended using the 'multiply' mode.

const chroma = require('chroma-js');
const blended = chroma.blend('red', 'blue', 'multiply').hex();
console.log(blended); // #000080

Other packages similar to @types/chroma-js

FAQs

Package last updated on 17 Dec 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