Product
Introducing Java Support in Socket
We're excited to announce that Socket now supports the Java programming language.
@types/d3-scale-chromatic
Advanced tools
TypeScript definitions for d3-scale-chromatic
@types/d3-scale-chromatic provides TypeScript type definitions for the d3-scale-chromatic library, which is part of the D3.js ecosystem. This library offers a variety of color scales that can be used for data visualization, including both continuous and discrete color schemes.
Continuous Color Scales
Continuous color scales interpolate colors smoothly across a range. The example uses the Viridis color scale to get a color at the midpoint.
const d3 = require('d3-scale-chromatic');
const scale = d3.interpolateViridis(0.5); // Returns a color in the middle of the Viridis scale
Discrete Color Scales
Discrete color scales provide a set of distinct colors. The example uses the Category10 scheme to get an array of 10 categorical colors.
const d3 = require('d3-scale-chromatic');
const colors = d3.schemeCategory10; // Returns an array of 10 categorical colors
Diverging Color Scales
Diverging color scales are useful for data that has a meaningful midpoint. The example uses the Red-Yellow-Blue scale to get a color at the midpoint.
const d3 = require('d3-scale-chromatic');
const scale = d3.interpolateRdYlBu(0.5); // Returns a color in the middle of the Red-Yellow-Blue diverging scale
Sequential Color Scales
Sequential color scales are used for data that progresses from low to high. The example uses the Blues scale to get a color at the midpoint.
const d3 = require('d3-scale-chromatic');
const scale = d3.interpolateBlues(0.5); // Returns a color in the middle of the Blues sequential scale
Chroma.js is a JavaScript library for color conversions and color scales. It offers a wide range of color manipulation and interpolation functionalities, similar to d3-scale-chromatic, but with additional features like color blending and color contrast calculations.
ColorBrewer is a library that provides color schemes for maps and data visualizations. It is similar to d3-scale-chromatic in that it offers a variety of color scales, but it is more focused on cartographic applications.
Colormap is a library that provides a variety of colormaps for data visualization. It is similar to d3-scale-chromatic in offering both continuous and discrete color scales, but it also includes some unique colormaps not found in d3-scale-chromatic.
npm install --save @types/d3-scale-chromatic
This package contains type definitions for d3-scale-chromatic (https://github.com/d3/d3-scale-chromatic/).
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/d3-scale-chromatic.
These definitions were written by Hugues Stefanski, Alex Ford, Boris Yankov, Henrique Machado, and Nathan Bierema.
FAQs
TypeScript definitions for d3-scale-chromatic
We found that @types/d3-scale-chromatic 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.
Product
We're excited to announce that Socket now supports the Java programming language.
Security News
Socket detected a malicious Python package impersonating a popular browser cookie library to steal passwords, screenshots, webcam images, and Discord tokens.
Security News
Deno 2.0 is now available with enhanced package management, full Node.js and npm compatibility, improved performance, and support for major JavaScript frameworks.