@dra2020/baseclient 1.0.66 → 1.0.69

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,11 @@
1
+ interface ColorLookup {
2
+ [key: string]: string;
3
+ }
4
+ export declare const ColorValues: ColorLookup;
5
+ export declare const EthnicFewClassicColors: string[];
6
+ export declare const PartisanPrecinctClassicColors: string[];
7
+ export declare function genColor(i: number, useFirstColor: boolean, palette: string): string;
8
+ export declare function getPalette(palette: string): string[];
9
+ export declare const defaultDistrictsPalette = "jet_r";
10
+ export declare function genDRAColor(i: number, useFirstColor: boolean): string;
11
+ export {};
@@ -0,0 +1,7 @@
1
+ export declare type DataTable = {
2
+ [key: string]: {
3
+ interpolate: boolean;
4
+ colors: any[];
5
+ };
6
+ };
7
+ export declare const data: DataTable;
package/lib/all/all.ts CHANGED
@@ -23,3 +23,5 @@ import * as Emit from '../emit/all';
23
23
  export { Emit };
24
24
  import * as CSV from '../csv/all';
25
25
  export { CSV };
26
+ import * as Colors from '../colors/colors';
27
+ export { Colors };
@@ -0,0 +1,618 @@
1
+ import * as JsColorMapsData from './jscolormapsdata';
2
+ import {Util} from '../all/all'
3
+
4
+ const MaxOrderedColors: number = 50;
5
+ const MaxColors: number = MaxOrderedColors * 3;
6
+ const MaxClassicColors: number = 55;
7
+
8
+ const DefaultColorNames: string[] =
9
+ [
10
+ 'GhostWhite',
11
+ 'Blue',
12
+ 'Green',
13
+ 'DarkMagenta',
14
+ 'Red',
15
+ 'Gold',
16
+ 'Teal',
17
+ 'Chocolate', //'DarkGray', //
18
+ 'SlateBlue',
19
+ 'Cyan',
20
+ 'DeepPink',
21
+ 'Chartreuse',
22
+ 'CornflowerBlue',
23
+ 'DarkSalmon',
24
+ 'Olive',
25
+ 'DarkOrange',
26
+ 'Lime',
27
+ 'DarkSlateBlue',
28
+ 'Yellow',
29
+ 'YellowGreen',
30
+ 'Pink',
31
+ 'Maroon',
32
+ 'Sienna',
33
+ 'Aquamarine',
34
+ 'Indigo',
35
+ 'PaleVioletRed',
36
+ 'Navy', // 'Gray', //
37
+ 'SpringGreen',
38
+ 'Plum',
39
+ 'DarkSeaGreen',
40
+ 'LightCoral',
41
+ 'Khaki',
42
+ 'OrangeRed',
43
+ 'RoyalBlue',
44
+ 'LimeGreen',
45
+ 'DarkOrchid',
46
+ 'Orange',
47
+ 'DodgerBlue',
48
+ 'MediumAquamarine',
49
+ 'Moccasin',
50
+ 'Firebrick',
51
+ 'LightSteelBlue',
52
+ 'LawnGreen',
53
+ 'Magenta',
54
+ 'MediumVioletRed',
55
+ 'Turquoise',
56
+ 'Tomato',
57
+ 'Thistle',
58
+ 'SandyBrown',
59
+ 'IndianRed',
60
+ 'PowderBlue',
61
+ 'SaddleBrown',
62
+ 'OliveDrab',
63
+ 'Fuchsia', // 'Gainsboro', //
64
+ 'PeachPuff',
65
+ 'RosyBrown',
66
+ ];
67
+
68
+ interface ColorLookup
69
+ {
70
+ [key: string]: string;
71
+ }
72
+
73
+ export const ColorValues: ColorLookup =
74
+ {
75
+ 'AliceBlue': '#F0F8FF',
76
+ 'AntiqueWhite': '#FAEBD7',
77
+ 'Aqua': '#00FFFF',
78
+ 'Aquamarine': '#7FFFD4',
79
+ 'Azure': '#F0FFFF',
80
+ 'Beige': '#F5F5DC',
81
+ 'Bisque': '#FFE4C4',
82
+ 'Black': '#000000',
83
+ 'BlanchedAlmond': '#FFEBCD',
84
+ 'Blue': '#0000FF',
85
+ 'BlueViolet': '#8A2BE2',
86
+ 'Brown': '#A52A2A',
87
+ 'BurlyWood': '#DEB887',
88
+ 'CadetBlue': '#5F9EA0',
89
+ 'Chartreuse': '#7FFF00',
90
+ 'Chocolate': '#D2691E',
91
+ 'Coral': '#FF7F50',
92
+ 'CornflowerBlue': '#6495ED',
93
+ 'Cornsilk': '#FFF8DC',
94
+ 'Crimson': '#DC143C',
95
+ 'Cyan': '#00FFFF',
96
+ 'DarkBlue': '#00008B',
97
+ 'DarkCyan': '#008B8B',
98
+ 'DarkGoldenrod': '#B8860B',
99
+ 'DarkGray': '#A9A9A9',
100
+ 'DarkGreen': '#006400',
101
+ 'DarkKhaki': '#BDB76B',
102
+ 'DarkMagenta': '#8B008B',
103
+ 'DarkOliveGreen': '#556B2F',
104
+ 'DarkOrange': '#FF8C00',
105
+ 'DarkOrchid': '#9932CC',
106
+ 'DarkRed': '#8B0000',
107
+ 'DarkSalmon': '#E9967A',
108
+ 'DarkSeaGreen': '#8FBC8F',
109
+ 'DarkSlateBlue': '#483D8B',
110
+ 'DarkSlateGray': '#2F4F4F',
111
+ 'DarkTurquoise': '#00CED1',
112
+ 'DarkViolet': '#9400D3',
113
+ 'DeepPink': '#FF1493',
114
+ 'DeepSkyBlue': '#00BFFF',
115
+ 'DimGray': '#696969',
116
+ 'DodgerBlue': '#1E90FF',
117
+ 'Firebrick': '#B22222',
118
+ 'FloralWhite': '#FFFAF0',
119
+ 'ForestGreen': '#228B22',
120
+ 'Fuchsia': '#FF00FF',
121
+ 'Gainsboro': '#DCDCDC',
122
+ 'GhostWhite': '#F8F8FF',
123
+ 'Gold': '#FFD700',
124
+ 'Goldenrod': '#DAA520',
125
+ 'Gray': '#808080',
126
+ 'Green': '#008000',
127
+ 'GreenYellow': '#ADFF2F',
128
+ 'Honeydew': '#F0FFF0',
129
+ 'HotPink': '#FF69B4',
130
+ 'IndianRed': '#CD5C5C',
131
+ 'Indigo': '#4B0082',
132
+ 'Ivory': '#FFFFF0',
133
+ 'Khaki': '#F0E68C',
134
+ 'Lavender': '#E6E6FA',
135
+ 'LavenderBlush': '#FFF0F5',
136
+ 'LawnGreen': '#7CFC00',
137
+ 'LemonChiffon': '#FFFACD',
138
+ 'LightBlue': '#ADD8E6',
139
+ 'LightCoral': '#F08080',
140
+ 'LightCyan': '#E0FFFF',
141
+ 'LightGoldenrodYellow': '#FAFAD2',
142
+ 'LightGray': '#D3D3D3',
143
+ 'LightGreen': '#90EE90',
144
+ 'LightPink': '#FFB6C1',
145
+ 'LightSalmon': '#FFA07A',
146
+ 'LightSeaGreen': '#20B2AA',
147
+ 'LightSkyBlue': '#87CEFA',
148
+ 'LightSlateGray': '#778899',
149
+ 'LightSteelBlue': '#B0C4DE',
150
+ 'LightYellow': '#FFFFE0',
151
+ 'Lime': '#00FF00',
152
+ 'LimeGreen': '#32CD32',
153
+ 'Linen': '#FAF0E6',
154
+ 'Magenta': '#FF00FF',
155
+ 'Maroon': '#800000',
156
+ 'MediumAquamarine': '#66CDAA',
157
+ 'MediumBlue': '#0000CD',
158
+ 'MediumOrchid': '#BA55D3',
159
+ 'MediumPurple': '#9370DB',
160
+ 'MediumSeaGreen': '#3CB371',
161
+ 'MediumSlateBlue': '#7B68EE',
162
+ 'MediumSpringGreen': '#00FA9A',
163
+ 'MediumTurquoise': '#48D1CC',
164
+ 'MediumVioletRed': '#C71585',
165
+ 'MidnightBlue': '#191970',
166
+ 'MintCream': '#F5FFFA',
167
+ 'MistyRose': '#FFE4E1',
168
+ 'Moccasin': '#FFE4B5',
169
+ 'NavajoWhite': '#FFDEAD',
170
+ 'Navy': '#000080',
171
+ 'OldLace': '#FDF5E6',
172
+ 'Olive': '#808000',
173
+ 'OliveDrab': '#6B8E23',
174
+ 'Orange': '#FFA500',
175
+ 'OrangeRed': '#FF4500',
176
+ 'Orchid': '#DA70D6',
177
+ 'PaleGoldenrod': '#EEE8AA',
178
+ 'PaleGreen': '#98FB98',
179
+ 'PaleTurquoise': '#AFEEEE',
180
+ 'PaleVioletRed': '#DB7093',
181
+ 'PapayaWhip': '#FFEFD5',
182
+ 'PeachPuff': '#FFDAB9',
183
+ 'Peru': '#CD853F',
184
+ 'Pink': '#FFC0CB',
185
+ 'Plum': '#DDA0DD',
186
+ 'PowderBlue': '#B0E0E6',
187
+ 'Purple': '#800080',
188
+ 'Red': '#FF0000',
189
+ 'RosyBrown': '#BC8F8F',
190
+ 'RoyalBlue': '#4169E1',
191
+ 'SaddleBrown': '#8B4513',
192
+ 'Salmon': '#FA8072',
193
+ 'SandyBrown': '#F4A460',
194
+ 'SeaGreen': '#2E8B57',
195
+ 'SeaShell': '#FFF5EE',
196
+ 'Sienna': '#A0522D',
197
+ 'Silver': '#C0C0C0',
198
+ 'SkyBlue': '#87CEEB',
199
+ 'SlateBlue': '#6A5ACD',
200
+ 'SlateGray': '#708090',
201
+ 'Snow': '#FFFAFA',
202
+ 'SpringGreen': '#00FF7F',
203
+ 'SteelBlue': '#4682B4',
204
+ 'Tan': '#D2B48C',
205
+ 'Teal': '#008080',
206
+ 'Thistle': '#D8BFD8',
207
+ 'Tomato': '#FF6347',
208
+ 'Turquoise': '#40E0D0',
209
+ 'Violet': '#EE82EE',
210
+ 'Wheat': '#F5DEB3',
211
+ 'White': '#FFFFFF',
212
+ 'WhiteSmoke': '#F5F5F5',
213
+ 'Yellow': '#FFFF00',
214
+ 'YellowGreen': '#9ACD32',
215
+ };
216
+
217
+ export const EthnicFewClassicColors = [
218
+ '#fafafa', //
219
+ '#aaaaaa', //
220
+ '#666666', //
221
+ '#111111', //
222
+ ];
223
+
224
+ export const PartisanPrecinctClassicColors = [
225
+ '#960018', // Carmine
226
+ '#FF2020', //
227
+ '#FF6060', //
228
+ '#FFA0A0', //
229
+ '#FFC0C0', //
230
+ '#FFDEDE', // pale red
231
+ '#DEDEFF', // pale blue
232
+ '#C0C0FF', //
233
+ '#A0A0FF', //
234
+ '#6060FF', //
235
+ '#2020FF', //
236
+ '#00008B', // Dark blue
237
+ ];
238
+
239
+ let ColorTable: {[key: string]: string[]} = {};
240
+ let OrderedColorTable: {[key: string]: string[]} = {};
241
+
242
+
243
+ export function genColor(i: number, useFirstColor: boolean, palette: string): string
244
+ {
245
+ // i is district number, 0 => District[0] (unassigned), so subtract 1 to access ColorTable
246
+
247
+ if (!useFirstColor || !palette)
248
+ return genDRAColor(i, useFirstColor);
249
+
250
+ if (i == 0)
251
+ return ColorValues[DefaultColorNames[0]];
252
+
253
+ switch (palette)
254
+ {
255
+ case 'jet':
256
+ case 'viridis':
257
+ case 'magma':
258
+ case 'plasma':
259
+ case 'bone':
260
+ case 'greys':
261
+ case 'inferno':
262
+ case 'turbo':
263
+ default:
264
+ return orderedColors(palette)[(i - 1) % MaxOrderedColors];
265
+
266
+ case 'draclassic':
267
+ return genDRAColor(i, useFirstColor);
268
+ }
269
+ }
270
+
271
+ export function getPalette(palette: string): string[]
272
+ {
273
+ if (palette === 'draclassic')
274
+ {
275
+ // return draclassic palette with only 30 colors
276
+ let colors: string[] = [];
277
+ for (let i = 1; i < 30; i++)
278
+ colors.push(genDRAColor(i, true));
279
+ return colors;
280
+ }
281
+
282
+ return getColorTable(palette);
283
+ }
284
+
285
+ const DistrictsColorOrder: number[] =
286
+ [0, 49, 24, 36, 12, 42, 6, 30, 18, 45, 3, 27, 9, 33, 15, 46, 21, 39, 4, 28, 10, 34, 16, 48, 22, 40, 5, 29, 11, 35, 17, 1, 23, 41,
287
+ 7, 31, 13, 37, 19, 47, 25, 43, 8, 32, 14, 38, 2, 20, 26, 44];
288
+
289
+ function orderedColors(palette: string): string[]
290
+ {
291
+ const colors = getPalette(palette);
292
+ if (!OrderedColorTable[palette])
293
+ {
294
+ OrderedColorTable[palette] = [];
295
+ for (let i: number = 0; i < MaxColors; i++)
296
+ {
297
+ OrderedColorTable[palette].push(colors[DistrictsColorOrder[i] * 3]);
298
+ }
299
+ }
300
+ return OrderedColorTable[palette];
301
+ }
302
+
303
+ export const defaultDistrictsPalette = 'jet_r';
304
+
305
+ // DRA classic color palette
306
+ export function genDRAColor(i: number, useFirstColor: boolean): string
307
+ {
308
+ // i is district number, 0 => District[0] (unassigned), so subtract 1 to access ColorTable
309
+ function gen_table(): void
310
+ {
311
+ ColorTable['draclassic'] = [];
312
+ for (let i: number = 0; i < MaxClassicColors; i++)
313
+ {
314
+ // A little funky math below to skip the first (white) color
315
+ let j = (i % (DefaultColorNames.length - 1)) + 1;
316
+ ColorTable['draclassic'].push(ColorValues[DefaultColorNames[j]]);
317
+ }
318
+ }
319
+
320
+ if (ColorTable == null)
321
+ gen_table();
322
+
323
+ if (i == 0)
324
+ return ColorValues[DefaultColorNames[0]];
325
+ return ColorTable['draclassic'][((i - 1) + (useFirstColor ? 0 : 1)) % MaxClassicColors];
326
+ }
327
+
328
+ // Generate table for palette
329
+ function getColorTable(palette: string): string[]
330
+ {
331
+ if (palette === 'demographicsclassic')
332
+ {
333
+ if (!ColorTable[palette])
334
+ {
335
+ ColorTable[palette] = [];
336
+ for (let i = 0; i < 4; i++)
337
+ ColorTable[palette].push(EthnicFewClassicColors[i]);
338
+ }
339
+ return ColorTable[palette];
340
+ }
341
+ else if (palette === 'partisanclassic')
342
+ {
343
+ if (!ColorTable[palette])
344
+ {
345
+ ColorTable[palette] = [];
346
+ for (let i = 0; i < 12; i++)
347
+ ColorTable[palette].push(PartisanPrecinctClassicColors[i]);
348
+ }
349
+ return ColorTable[palette];
350
+ }
351
+
352
+ if (allPaletteNames.includes(palette))
353
+ {
354
+ if (!ColorTable[palette])
355
+ ColorTable[palette] = jscolormap(palette, MaxColors);
356
+ return ColorTable[palette];
357
+ }
358
+ else
359
+ return ['#ffffff'];
360
+ }
361
+
362
+ // Helpers
363
+ function toHexColor(r: number, g: number, b: number): string
364
+ {
365
+ return `#${Util.toHex(r)}${Util.toHex(g)}${Util.toHex(b)}`;
366
+ }
367
+
368
+ function jscolormap(name: string, shades: number): string[]
369
+ {
370
+ let result: string[] = [];
371
+ for (let i = 0; i < shades; i++)
372
+ {
373
+ const rgb: number[] = partial(name)((i + 0.5) / shades);
374
+ result.push(toHexColor(rgb[0], rgb[1], rgb[2]));
375
+ }
376
+ return result;
377
+ }
378
+
379
+ // ****************************************************************
380
+ // js-colormaps was made by Timothy Gebhard (https://github.com/timothygebhard/js-colormaps),
381
+ // used here under MIT License, and modified for TypeScript
382
+
383
+ const allPaletteNames: string[] = [
384
+ 'Accent',
385
+ 'Accent_r',
386
+ 'Blues',
387
+ 'Blues_r',
388
+ 'BrBG',
389
+ 'BrBG_r',
390
+ 'BuGn',
391
+ 'BuGn_r',
392
+ 'BuPu',
393
+ 'BuPu_r',
394
+ 'CMRmap',
395
+ 'CMRmap_r',
396
+ 'Dark2',
397
+ 'Dark2_r',
398
+ 'GnBu',
399
+ 'GnBu_r',
400
+ 'Greens',
401
+ 'Greens_r',
402
+ 'Greys',
403
+ 'Greys_r',
404
+ 'OrRd',
405
+ 'OrRd_r',
406
+ 'Oranges',
407
+ 'Oranges_r',
408
+ 'PRGn',
409
+ 'PRGn_r',
410
+ 'Paired',
411
+ 'Paired_r',
412
+ 'Pastel1',
413
+ 'Pastel1_r',
414
+ 'Pastel2',
415
+ 'Pastel2_r',
416
+ 'PiYG',
417
+ 'PiYG_r',
418
+ 'PuBu',
419
+ 'PuBu_r',
420
+ 'PuBuGn',
421
+ 'PuBuGn_r',
422
+ 'PuOr',
423
+ 'PuOr_r',
424
+ 'PuRd',
425
+ 'PuRd_r',
426
+ 'Purples',
427
+ 'Purples_r',
428
+ 'RdBu',
429
+ 'RdBu_r',
430
+ 'RdGy',
431
+ 'RdGy_r',
432
+ 'RdPu',
433
+ 'RdPu_r',
434
+ 'RdYlBu',
435
+ 'RdYlBu_r',
436
+ 'RdYlGn',
437
+ 'RdYlGn_r',
438
+ 'Reds',
439
+ 'Reds_r',
440
+ 'Set1',
441
+ 'Set1_r',
442
+ 'Set2',
443
+ 'Set2_r',
444
+ 'Set3',
445
+ 'Set3_r',
446
+ 'Spectral',
447
+ 'Spectral_r',
448
+ 'Wistia',
449
+ 'Wistia_r',
450
+ 'YlGn',
451
+ 'YlGn_r',
452
+ 'YlGnBu',
453
+ 'YlGnBu_r',
454
+ 'YlOrBr',
455
+ 'YlOrBr_r',
456
+ 'YlOrRd',
457
+ 'YlOrRd_r',
458
+ 'afmhot',
459
+ 'afmhot_r',
460
+ 'autumn',
461
+ 'autumn_r',
462
+ 'binary',
463
+ 'binary_r',
464
+ 'bone',
465
+ 'bone_r',
466
+ 'brg',
467
+ 'brg_r',
468
+ 'bwr',
469
+ 'bwr_r',
470
+ 'cividis',
471
+ 'cividis_r',
472
+ 'cool',
473
+ 'cool_r',
474
+ 'coolwarm',
475
+ 'coolwarm_r',
476
+ 'copper',
477
+ 'copper_r',
478
+ 'cubehelix',
479
+ 'cubehelix_r',
480
+ 'flag',
481
+ 'flag_r',
482
+ 'gist_earth',
483
+ 'gist_earth_r',
484
+ 'gist_gray',
485
+ 'gist_gray_r',
486
+ 'gist_heat',
487
+ 'gist_heat_r',
488
+ 'gist_ncar',
489
+ 'gist_ncar_r',
490
+ 'gist_rainbow',
491
+ 'gist_rainbow_r',
492
+ 'gist_stern',
493
+ 'gist_stern_r',
494
+ 'gist_yarg',
495
+ 'gist_yarg_r',
496
+ 'gnuplot',
497
+ 'gnuplot_r',
498
+ 'gnuplot2',
499
+ 'gnuplot2_r',
500
+ 'gray',
501
+ 'gray_r',
502
+ 'hot',
503
+ 'hot_r',
504
+ 'hsv',
505
+ 'hsv_r',
506
+ 'inferno',
507
+ 'inferno_r',
508
+ 'jet',
509
+ 'jet_r',
510
+ 'magma',
511
+ 'magma_r',
512
+ 'nipy_spectral',
513
+ 'nipy_spectral_r',
514
+ 'ocean',
515
+ 'ocean_r',
516
+ 'pink',
517
+ 'pink_r',
518
+ 'plasma',
519
+ 'plasma_r',
520
+ 'prism',
521
+ 'prism_r',
522
+ 'rainbow',
523
+ 'rainbow_r',
524
+ 'seismic',
525
+ 'seismic_r',
526
+ 'spring',
527
+ 'spring_r',
528
+ 'summer',
529
+ 'summer_r',
530
+ 'tab10',
531
+ 'tab10_r',
532
+ 'tab20',
533
+ 'tab20_r',
534
+ 'tab20b',
535
+ 'tab20b_r',
536
+ 'tab20c',
537
+ 'tab20c_r',
538
+ 'terrain',
539
+ 'terrain_r',
540
+ 'turbo',
541
+ 'turbo_r',
542
+ 'twilight',
543
+ 'twilight_r',
544
+ 'twilight_shifted',
545
+ 'twilight_shifted_r',
546
+ 'viridis',
547
+ 'viridis_r',
548
+ 'winter',
549
+ 'winter_r'];
550
+
551
+ /*
552
+ Define auxiliary functions for evaluating colormaps
553
+ */
554
+
555
+ function evaluate_cmap(x: number, name: string, reverse: boolean) {
556
+ /**
557
+ * Evaluate colormap `name` at some value `x`.
558
+ * @param {number} x - The value (between 0 and 1) at which to evaluate the colormap.
559
+ * @param {string} name - The name of the colormap (see matplotlib documentation).
560
+ * @reverse {boolean} reverse - Whether or not to reverse the colormap.
561
+ * @return {list} - A 3-tuple (R, G, B) containing the color assigned to `x`.
562
+ */
563
+
564
+ // Ensure that the value of `x` is valid (i.e., 0 <= x <= 1)
565
+ if (!(0 <= x && x <= 1)) {
566
+ alert('Illegal value for x! Must be in [0, 1].')
567
+ }
568
+
569
+ // Ensure that `name` is a valid colormap
570
+ if (!(name in JsColorMapsData.data)) {
571
+ alert('Colormap ' + name + 'does not exist!');
572
+ }
573
+
574
+ // We can get the reverse colormap by evaluating colormap(1-x)
575
+ if (reverse === true) {
576
+ x = 1 - x;
577
+ }
578
+
579
+ // Get the colors and whether or not we need to interpolate
580
+ let colors = JsColorMapsData.data[name]['colors'];
581
+ let interpolate = JsColorMapsData.data[name]['interpolate'];
582
+
583
+ if (interpolate === true) {
584
+ return interpolated(x, colors);
585
+ } else {
586
+ return qualitative(x, colors);
587
+ }
588
+ }
589
+
590
+ function interpolated(x: number, colors: any[]) {
591
+ let lo = Math.floor(x * (colors.length - 1));
592
+ let hi = Math.ceil(x * (colors.length - 1));
593
+ let r = Math.round((colors[lo][0] + colors[hi][0]) / 2 * 255);
594
+ let g = Math.round((colors[lo][1] + colors[hi][1]) / 2 * 255);
595
+ let b = Math.round((colors[lo][2] + colors[hi][2]) / 2 * 255);
596
+ return [r, g, b];
597
+ }
598
+
599
+ function qualitative(x: number, colors: any[]) {
600
+ let idx = 0;
601
+ while (x > (idx + 1) / (colors.length - 0) ) { idx++; }
602
+ let r = Math.round(colors[idx][0] * 255);
603
+ let g = Math.round(colors[idx][1] * 255);
604
+ let b = Math.round(colors[idx][2] * 255);
605
+ return [r, g, b];
606
+ }
607
+
608
+ function partial(name: string) {
609
+ if (name.endsWith('_r')) {
610
+ return function(x: number) { return evaluate_cmap(x, name.substring(0, name.length - 2), true) };
611
+ } else {
612
+ return function(x: number) { return evaluate_cmap(x, name, false) };
613
+ }
614
+
615
+ }
616
+
617
+ // End of js-colormaps
618
+ // *********************************************************