Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
@types/chroma-js
Advanced tools
TypeScript definitions for 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.
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
The 'color' package is a JavaScript library for color conversions and manipulations. It provides similar functionalities to chroma-js, such as color parsing, conversion, and manipulation, but it does not focus on color scales.
The 'tinycolor2' package is another JavaScript library for color manipulation and conversion. It offers a wide range of color operations and is known for its small size and ease of use. It is similar to chroma-js but does not provide as extensive support for color scales.
The 'd3-color' package is part of the D3.js library and provides color manipulation and conversion functionalities. It is similar to chroma-js in terms of color operations but is more integrated into the D3 ecosystem for data visualization.
npm install --save @types/chroma-js
This package contains type definitions for chroma-js (https://github.com/gka/chroma.js).
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/chroma-js.
These definitions were written by Sebastian Brückner, Marcin Pacholec, and Charlie Zhuo.
FAQs
TypeScript definitions for chroma-js
We found that @types/chroma-js demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.