Merge pull request #19574 from henriquefm/master

d3-scale-chromatic - Adding missing schemes
This commit is contained in:
Nathan Shively-Sanders
2017-09-07 10:57:10 -07:00
committed by GitHub
2 changed files with 256 additions and 10 deletions

View File

@@ -33,6 +33,16 @@ const RdYlBu: string = d3ScaleChromatic.interpolateRdYlBu(0); // rgb(103, 0, 31)
const RdYlGn: string = d3ScaleChromatic.interpolateRdYlGn(0); // rgb(103, 0, 31)
const Spectral: string = d3ScaleChromatic.interpolateSpectral(0); // rgb(158, 1, 66)
const schemeBrBG: string = d3ScaleChromatic.schemeBrBG[3][0]; // #d8b365
const schemePRGn: string = d3ScaleChromatic.schemePRGn[3][0]; // #af8dc3
const schemePiYG: string = d3ScaleChromatic.schemePiYG[3][0]; // #e9a3c9
const schemePuOr: string = d3ScaleChromatic.schemePuOr[3][0]; // #998ec3
const schemeRdBu: string = d3ScaleChromatic.schemeRdBu[3][0]; // #ef8a62
const schemeRdGy: string = d3ScaleChromatic.schemeRdGy[3][0]; // #ef8a62
const schemeRdYlBu: string = d3ScaleChromatic.schemeRdYlBu[3][0]; // #fc8d59
const schemeRdYlGn: string = d3ScaleChromatic.schemeRdYlGn[3][0]; // #fc8d59
const schemeSpectral: string = d3ScaleChromatic.schemeSpectral[3][0]; // #fc8d59
// -----------------------------------------------------------------------
// Sequential
// -----------------------------------------------------------------------
@@ -43,6 +53,13 @@ const Orange: string = d3ScaleChromatic.interpolateOranges(1); // rgb(127, 39, 4
const Purple: string = d3ScaleChromatic.interpolatePurples(1); // rgb(63, 0, 125)
const Red: string = d3ScaleChromatic.interpolateReds(1); // rgb(103, 0, 13)
const schemeBlues: string = d3ScaleChromatic.schemeBlues[3][0]; // #deebf7
const schemeGreens: string = d3ScaleChromatic.schemeGreens[3][0]; // #e5f5e0
const schemeGreys: string = d3ScaleChromatic.schemeGreys[3][0]; // #f0f0f0
const schemeOranges: string = d3ScaleChromatic.schemeOranges[3][0]; // #fee6ce
const schemePurples: string = d3ScaleChromatic.schemePurples[3][0]; // #efedf5
const schemeReds: string = d3ScaleChromatic.schemeReds[3][0]; // #fee0d2
// -----------------------------------------------------------------------
// Sequential(Multi-Hue)
// -----------------------------------------------------------------------
@@ -58,3 +75,16 @@ const YlGnBu: string = d3ScaleChromatic.interpolateYlGnBu(1); // rgb(8, 29, 88)
const YlGn: string = d3ScaleChromatic.interpolateYlGn(1); // rgb(0, 69, 41)
const YlOrBr: string = d3ScaleChromatic.interpolateYlOrBr(1); // rgb(102, 37, 6)
const YlOrRd: string = d3ScaleChromatic.interpolateYlOrRd(1); // rgb(128, 0, 38)
const schemeBuGn: string = d3ScaleChromatic.schemeBuGn[3][0]; // #e5f5f9
const schemeBuPu: string = d3ScaleChromatic.schemeBuPu[3][0]; // #e0ecf4
const schemeGnBu: string = d3ScaleChromatic.schemeGnBu[3][0]; // #e0f3db
const schemeOrRd: string = d3ScaleChromatic.schemeOrRd[3][0]; // #fee8c8
const schemePuBuGn: string = d3ScaleChromatic.schemePuBuGn[3][0]; // #ece2f0
const schemePuBu: string = d3ScaleChromatic.schemePuBu[3][0]; // #ece7f2
const schemePuRd: string = d3ScaleChromatic.schemePuRd[3][0]; // #e7e1ef
const schemeRdPu: string = d3ScaleChromatic.schemeRdPu[3][0]; // #fde0dd
const schemeYlGnBu: string = d3ScaleChromatic.schemeYlGnBu[3][0]; // #edf8b1
const schemeYlGn: string = d3ScaleChromatic.schemeYlGn[3][0]; // #f7fcb9
const schemeYlOrBr: string = d3ScaleChromatic.schemeYlOrBr[3][0]; // #fff7bc
const schemeYlOrRd: string = d3ScaleChromatic.schemeYlOrRd[3][0]; // #ffeda0

View File

@@ -1,6 +1,9 @@
// Type definitions for D3JS d3-scale-chromatic module 1.0
// Type definitions for D3JS d3-scale-chromatic module 1.1
// Project: https://github.com/d3/d3-scale-chromatic/
// Definitions by: Hugues Stefanski <https://github.com/Ledragon>, Alex Ford <https://github.com/gustavderdrache>, Boris Yankov <https://github.com/borisyankov>
// Definitions by: Hugues Stefanski <https://github.com/Ledragon>,
// Alex Ford <https://github.com/gustavderdrache>,
// Boris Yankov <https://github.com/borisyankov>,
// Henrique Machado <https://github.com/henriquefm>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// Last module patch version validated against: 1.0.2
@@ -11,35 +14,35 @@
/**
* An array of eight categorical colors represented as RGB hexadecimal strings.
*/
export const schemeAccent: string[];
export const schemeAccent: ReadonlyArray<string>;
/**
* An array of eight categorical colors represented as RGB hexadecimal strings.
*/
export const schemeDark2: string[];
export const schemeDark2: ReadonlyArray<string>;
/**
* An array of twelve categorical colors represented as RGB hexadecimal strings.
*/
export const schemePaired: string[];
export const schemePaired: ReadonlyArray<string>;
/**
* An array of nine categorical colors represented as RGB hexadecimal strings.
*/
export const schemePastel1: string[];
export const schemePastel1: ReadonlyArray<string>;
/**
* An array of eight categorical colors represented as RGB hexadecimal strings.
*/
export const schemePastel2: string[];
export const schemePastel2: ReadonlyArray<string>;
/**
* An array of nine categorical colors represented as RGB hexadecimal strings.
*/
export const schemeSet1: string[];
export const schemeSet1: ReadonlyArray<string>;
/**
* An array of eight categorical colors represented as RGB hexadecimal strings.
*/
export const schemeSet2: string[];
export const schemeSet2: ReadonlyArray<string>;
/**
* An array of twelve categorical colors represented as RGB hexadecimal strings.
*/
export const schemeSet3: string[];
export const schemeSet3: ReadonlyArray<string>;
// -----------------------------------------------------------------------
// Diverging
@@ -50,48 +53,112 @@ export const schemeSet3: string[];
* @param value Number in the range [0, 1].
*/
export function interpolateBrBG(value: number): string;
/**
* An array of arrays of hexadecimal color strings from the “BrBG” diverging color scheme. The kth element of this array contains
* the color scheme of size k; for example, d3.schemeBrBG[9] contains an array of nine strings representing the nine colors of the
* brown-blue-green diverging color scheme. Diverging color schemes support a size k ranging from 3 to 11.
*/
export const schemeBrBG: ReadonlyArray<ReadonlyArray<string>>;
/**
* Given a number t in the range [0,1], returns the corresponding color from the “PRGn” diverging color scheme represented as an RGB string.
*
* @param value Number in the range [0, 1].
*/
export function interpolatePRGn(value: number): string;
/**
* An array of arrays of hexadecimal color strings from the “PRGn” diverging color scheme. The kth element of this array contains
* the color scheme of size k; for example, d3.schemePRGn[9] contains an array of nine strings representing the nine colors of the
* purple-green diverging color scheme. Diverging color schemes support a size k ranging from 3 to 11.
*/
export const schemePRGn: ReadonlyArray<ReadonlyArray<string>>;
/**
* Given a number t in the range [0,1], returns the corresponding color from the “PiYG” diverging color scheme represented as an RGB string.
*
* @param value Number in the range [0, 1].
*/
export function interpolatePiYG(value: number): string;
/**
* An array of arrays of hexadecimal color strings from the “PiYG” diverging color scheme. The kth element of this array contains
* the color scheme of size k; for example, d3.schemePiYG[9] contains an array of nine strings representing the nine colors of the
* pink-yellow-green diverging color scheme. Diverging color schemes support a size k ranging from 3 to 11.
*/
export const schemePiYG: ReadonlyArray<ReadonlyArray<string>>;
/**
* Given a number t in the range [0,1], returns the corresponding color from the “PuOr” diverging color scheme represented as an RGB string.
*
* @param value Number in the range [0, 1].
*/
export function interpolatePuOr(value: number): string;
/**
* An array of arrays of hexadecimal color strings from the “PuOr” diverging color scheme. The kth element of this array contains
* the color scheme of size k; for example, d3.schemePuOr[9] contains an array of nine strings representing the nine colors of the
* purple-orange diverging color scheme. Diverging color schemes support a size k ranging from 3 to 11.
*/
export const schemePuOr: ReadonlyArray<ReadonlyArray<string>>;
/**
* Given a number t in the range [0,1], returns the corresponding color from the “RdBu” diverging color scheme represented as an RGB string.
*
* @param value Number in the range [0, 1].
*/
export function interpolateRdBu(value: number): string;
/**
* An array of arrays of hexadecimal color strings from the “RdBu” diverging color scheme. The kth element of this array contains
* the color scheme of size k; for example, d3.schemeRdBu[9] contains an array of nine strings representing the nine colors of the
* red-blue diverging color scheme. Diverging color schemes support a size k ranging from 3 to 11.
*/
export const schemeRdBu: ReadonlyArray<ReadonlyArray<string>>;
/**
* Given a number t in the range [0,1], returns the corresponding color from the “RdGy” diverging color scheme represented as an RGB string.
*
* @param value Number in the range [0, 1].
*/
export function interpolateRdGy(value: number): string;
/**
* An array of arrays of hexadecimal color strings from the “RdGy” diverging color scheme. The kth element of this array contains
* the color scheme of size k; for example, d3.schemeRdGy[9] contains an array of nine strings representing the nine colors of the
* red-grey diverging color scheme. Diverging color schemes support a size k ranging from 3 to 11.
*/
export const schemeRdGy: ReadonlyArray<ReadonlyArray<string>>;
/**
* Given a number t in the range [0,1], returns the corresponding color from the “RdYlBu” diverging color scheme represented as an RGB string.
*
* @param value Number in the range [0, 1].
*/
export function interpolateRdYlBu(value: number): string;
/**
* An array of arrays of hexadecimal color strings from the “RdYlBu” diverging color scheme. The kth element of this array contains
* the color scheme of size k; for example, d3.schemeRdYlBu[9] contains an array of nine strings representing the nine colors of the
* red-yellow-blue diverging color scheme. Diverging color schemes support a size k ranging from 3 to 11.
*/
export const schemeRdYlBu: ReadonlyArray<ReadonlyArray<string>>;
/**
* Given a number t in the range [0,1], returns the corresponding color from the “RdYlGn” diverging color scheme represented as an RGB string.
*
* @param value Number in the range [0, 1].
*/
export function interpolateRdYlGn(value: number): string;
/**
* An array of arrays of hexadecimal color strings from the “RdYlGn” diverging color scheme. The kth element of this array contains
* the color scheme of size k; for example, d3.schemeRdYlGn[9] contains an array of nine strings representing the nine colors of the
* red-yellow-green diverging color scheme. Diverging color schemes support a size k ranging from 3 to 11.
*/
export const schemeRdYlGn: ReadonlyArray<ReadonlyArray<string>>;
/**
* Given a number t in the range [0,1], returns the corresponding color from the “Spectral” diverging color scheme represented as an RGB string.
*
@@ -99,6 +166,13 @@ export function interpolateRdYlGn(value: number): string;
*/
export function interpolateSpectral(value: number): string;
/**
* An array of arrays of hexadecimal color strings from the “Spectral” diverging color scheme. The kth element of this array contains
* the color scheme of size k; for example, d3.schemeSpectral[9] contains an array of nine strings representing the nine colors of the
* spectral diverging color scheme. Diverging color schemes support a size k ranging from 3 to 11.
*/
export const schemeSpectral: ReadonlyArray<ReadonlyArray<string>>;
// -----------------------------------------------------------------------
// Sequential
// -----------------------------------------------------------------------
@@ -108,30 +182,70 @@ export function interpolateSpectral(value: number): string;
* @param value Number in the range [0, 1].
*/
export function interpolateBlues(value: number): string;
/**
* An array of arrays of hexadecimal color strings from the “Blues” sequential color scheme. The kth element of this array contains
* the color scheme of size k; for example, d3.schemeBlues[9] contains an array of nine strings representing the nine colors of the
* blue sequential color scheme. Sequential, single-hue color schemes support a size k ranging from 3 to 9.
*/
export const schemeBlues: ReadonlyArray<ReadonlyArray<string>>;
/**
* Given a number t in the range [0,1], returns the corresponding color from the “Greens” sequential color scheme represented as an RGB string.
*
* @param value Number in the range [0, 1].
*/
export function interpolateGreens(value: number): string;
/**
* An array of arrays of hexadecimal color strings from the “Greens” sequential color scheme. The kth element of this array contains
* the color scheme of size k; for example, d3.schemeGreens[9] contains an array of nine strings representing the nine colors of the
* green sequential color scheme. Sequential, single-hue color schemes support a size k ranging from 3 to 9.
*/
export const schemeGreens: ReadonlyArray<ReadonlyArray<string>>;
/**
* Given a number t in the range [0,1], returns the corresponding color from the “Greys” sequential color scheme represented as an RGB string.
*
* @param value Number in the range [0, 1].
*/
export function interpolateGreys(value: number): string;
/**
* An array of arrays of hexadecimal color strings from the “Greys” sequential color scheme. The kth element of this array contains
* the color scheme of size k; for example, d3.schemeGreys[9] contains an array of nine strings representing the nine colors of the
* grey sequential color scheme. Sequential, single-hue color schemes support a size k ranging from 3 to 9.
*/
export const schemeGreys: ReadonlyArray<ReadonlyArray<string>>;
/**
* Given a number t in the range [0,1], returns the corresponding color from the “Oranges” sequential color scheme represented as an RGB string.
*
* @param value Number in the range [0, 1].
*/
export function interpolateOranges(value: number): string;
/**
* An array of arrays of hexadecimal color strings from the “Oranges” sequential color scheme. The kth element of this array contains
* the color scheme of size k; for example, d3.schemeOranges[9] contains an array of nine strings representing the nine colors of the
* orange sequential color scheme. Sequential, single-hue color schemes support a size k ranging from 3 to 9.
*/
export const schemeOranges: ReadonlyArray<ReadonlyArray<string>>;
/**
* Given a number t in the range [0,1], returns the corresponding color from the “Purples” sequential color scheme represented as an RGB string.
*
* @param value Number in the range [0, 1].
*/
export function interpolatePurples(value: number): string;
/**
* An array of arrays of hexadecimal color strings from the “Purples” sequential color scheme. The kth element of this array contains
* the color scheme of size k; for example, d3.schemePurples[9] contains an array of nine strings representing the nine colors of the
* purple sequential color scheme. Sequential, single-hue color schemes support a size k ranging from 3 to 9.
*/
export const schemePurples: ReadonlyArray<ReadonlyArray<string>>;
/**
* Given a number t in the range [0,1], returns the corresponding color from the “Reds” sequential color scheme represented as an RGB string.
*
@@ -139,6 +253,13 @@ export function interpolatePurples(value: number): string;
*/
export function interpolateReds(value: number): string;
/**
* An array of arrays of hexadecimal color strings from the “Reds” sequential color scheme. The kth element of this array contains
* the color scheme of size k; for example, d3.schemeReds[9] contains an array of nine strings representing the nine colors of the
* red sequential color scheme. Sequential, single-hue color schemes support a size k ranging from 3 to 9.
*/
export const schemeReds: ReadonlyArray<ReadonlyArray<string>>;
// -----------------------------------------------------------------------
// Sequential(Multi-Hue)
// -----------------------------------------------------------------------
@@ -149,69 +270,164 @@ export function interpolateReds(value: number): string;
* @param value Number in the range [0, 1].
*/
export function interpolateBuGn(value: number): string;
/**
* An array of arrays of hexadecimal color strings from the “BuGn” sequential color scheme. The kth element of this array contains
* the color scheme of size k; for example, d3.schemeBuGn[9] contains an array of nine strings representing the nine colors of the
* blue-green sequential color scheme. Sequential, multi-hue color schemes support a size k ranging from 3 to 9.
*/
export const schemeBuGn: ReadonlyArray<ReadonlyArray<string>>;
/**
* Given a number t in the range [0,1], returns the corresponding color from the “BuPu” sequential color scheme represented as an RGB string.
*
* @param value Number in the range [0, 1].
*/
export function interpolateBuPu(value: number): string;
/**
* An array of arrays of hexadecimal color strings from the “BuPu” sequential color scheme. The kth element of this array contains
* the color scheme of size k; for example, d3.schemeBuPu[9] contains an array of nine strings representing the nine colors of the
* blue-purple sequential color scheme. Sequential, multi-hue color schemes support a size k ranging from 3 to 9.
*/
export const schemeBuPu: ReadonlyArray<ReadonlyArray<string>>;
/**
* Given a number t in the range [0,1], returns the corresponding color from the “GnBu” sequential color scheme represented as an RGB string.
*
* @param value Number in the range [0, 1].
*/
export function interpolateGnBu(value: number): string;
/**
* An array of arrays of hexadecimal color strings from the “GnBu” sequential color scheme. The kth element of this array contains
* the color scheme of size k; for example, d3.schemeGnBu[9] contains an array of nine strings representing the nine colors of the
* green-blue sequential color scheme. Sequential, multi-hue color schemes support a size k ranging from 3 to 9.
*/
export const schemeGnBu: ReadonlyArray<ReadonlyArray<string>>;
/**
* Given a number t in the range [0,1], returns the corresponding color from the “OrRd” sequential color scheme represented as an RGB string.
*
* @param value Number in the range [0, 1].
*/
export function interpolateOrRd(value: number): string;
/**
* An array of arrays of hexadecimal color strings from the “OrRd” sequential color scheme. The kth element of this array contains
* the color scheme of size k; for example, d3.schemeOrRd[9] contains an array of nine strings representing the nine colors of the
* orange-red sequential color scheme. Sequential, multi-hue color schemes support a size k ranging from 3 to 9.
*/
export const schemeOrRd: ReadonlyArray<ReadonlyArray<string>>;
/**
* Given a number t in the range [0,1], returns the corresponding color from the “PuBuGn” sequential color scheme represented as an RGB string.
*
* @param value Number in the range [0, 1].
*/
export function interpolatePuBuGn(value: number): string;
/**
* An array of arrays of hexadecimal color strings from the “PuBuGn” sequential color scheme. The kth element of this array contains
* the color scheme of size k; for example, d3.schemePuBuGn[9] contains an array of nine strings representing the nine colors of the
* purple-blue-green sequential color scheme. Sequential, multi-hue color schemes support a size k ranging from 3 to 9.
*/
export const schemePuBuGn: ReadonlyArray<ReadonlyArray<string>>;
/**
* Given a number t in the range [0,1], returns the corresponding color from the “PuBu” sequential color scheme represented as an RGB string.
*
* @param value Number in the range [0, 1].
*/
export function interpolatePuBu(value: number): string;
/**
* An array of arrays of hexadecimal color strings from the “PuBu” sequential color scheme. The kth element of this array contains
* the color scheme of size k; for example, d3.schemePuBu[9] contains an array of nine strings representing the nine colors of the
* purple-blue sequential color scheme. Sequential, multi-hue color schemes support a size k ranging from 3 to 9.
*/
export const schemePuBu: ReadonlyArray<ReadonlyArray<string>>;
/**
* Given a number t in the range [0,1], returns the corresponding color from the “PuRd” sequential color scheme represented as an RGB string.
*
* @param value Number in the range [0, 1].
*/
export function interpolatePuRd(value: number): string;
/**
* An array of arrays of hexadecimal color strings from the “PuRd” sequential color scheme. The kth element of this array contains
* the color scheme of size k; for example, d3.schemePuRd[9] contains an array of nine strings representing the nine colors of the
* purple-red sequential color scheme. Sequential, multi-hue color schemes support a size k ranging from 3 to 9.
*/
export const schemePuRd: ReadonlyArray<ReadonlyArray<string>>;
/**
* Given a number t in the range [0,1], returns the corresponding color from the “RdPu” sequential color scheme represented as an RGB string.
*
* @param value Number in the range [0, 1].
*/
export function interpolateRdPu(value: number): string;
/**
* An array of arrays of hexadecimal color strings from the “RdPu” sequential color scheme. The kth element of this array contains
* the color scheme of size k; for example, d3.schemeRdPu[9] contains an array of nine strings representing the nine colors of the
* red-purple sequential color scheme. Sequential, multi-hue color schemes support a size k ranging from 3 to 9.
*/
export const schemeRdPu: ReadonlyArray<ReadonlyArray<string>>;
/**
* Given a number t in the range [0,1], returns the corresponding color from the “YlGnBu” sequential color scheme represented as an RGB string.
*
* @param value Number in the range [0, 1].
*/
export function interpolateYlGnBu(value: number): string;
/**
* An array of arrays of hexadecimal color strings from the “YlGnBu” sequential color scheme. The kth element of this array contains
* the color scheme of size k; for example, d3.schemeYlGnBu[9] contains an array of nine strings representing the nine colors of the
* yellow-green-blue sequential color scheme. Sequential, multi-hue color schemes support a size k ranging from 3 to 9.
*/
export const schemeYlGnBu: ReadonlyArray<ReadonlyArray<string>>;
/**
* Given a number t in the range [0,1], returns the corresponding color from the “YlGn” sequential color scheme represented as an RGB string.
*
* @param value Number in the range [0, 1].
*/
export function interpolateYlGn(value: number): string;
/**
* An array of arrays of hexadecimal color strings from the “YlGn” sequential color scheme. The kth element of this array contains
* the color scheme of size k; for example, d3.schemeYlGn[9] contains an array of nine strings representing the nine colors of the
* yellow-green sequential color scheme. Sequential, multi-hue color schemes support a size k ranging from 3 to 9.
*/
export const schemeYlGn: ReadonlyArray<ReadonlyArray<string>>;
/**
* Given a number t in the range [0,1], returns the corresponding color from the “YlOrBr” sequential color scheme represented as an RGB string.
*
* @param value Number in the range [0, 1].
*/
export function interpolateYlOrBr(value: number): string;
/**
* An array of arrays of hexadecimal color strings from the “YlOrBr” sequential color scheme. The kth element of this array contains
* the color scheme of size k; for example, d3.schemeYlOrBr[9] contains an array of nine strings representing the nine colors of the
* yellow-orange-brown sequential color scheme. Sequential, multi-hue color schemes support a size k ranging from 3 to 9.
*/
export const schemeYlOrBr: ReadonlyArray<ReadonlyArray<string>>;
/**
* Given a number t in the range [0,1], returns the corresponding color from the “YlOrRd” sequential color scheme represented as an RGB string.
*
* @param value Number in the range [0, 1].
*/
export function interpolateYlOrRd(value: number): string;
/**
* An array of arrays of hexadecimal color strings from the “YlOrRd” sequential color scheme. The kth element of this array contains
* the color scheme of size k; for example, d3.schemeYlOrRd[9] contains an array of nine strings representing the nine colors of the
* yellow-orange-red sequential color scheme. Sequential, multi-hue color schemes support a size k ranging from 3 to 9.
*/
export const schemeYlOrRd: ReadonlyArray<ReadonlyArray<string>>;