@dra2020/baseclient 1.0.68 → 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.
@@ -6,6 +6,6 @@ export declare const EthnicFewClassicColors: string[];
6
6
  export declare const PartisanPrecinctClassicColors: string[];
7
7
  export declare function genColor(i: number, useFirstColor: boolean, palette: string): string;
8
8
  export declare function getPalette(palette: string): string[];
9
- export declare const defaultDistrictsPalette = "jet";
9
+ export declare const defaultDistrictsPalette = "jet_r";
10
10
  export declare function genDRAColor(i: number, useFirstColor: boolean): string;
11
11
  export {};
@@ -270,29 +270,16 @@ export function genColor(i: number, useFirstColor: boolean, palette: string): st
270
270
 
271
271
  export function getPalette(palette: string): string[]
272
272
  {
273
- let colors: string[] = [];
274
- switch (palette)
273
+ if (palette === 'draclassic')
275
274
  {
276
- case 'jet':
277
- case 'viridis':
278
- case 'magma':
279
- case 'plasma':
280
- case 'bone':
281
- case 'inferno':
282
- case 'turbo':
283
- case 'demographicsclassic':
284
- case 'partisanclassic':
285
- case 'allgroupsclassic':
286
- return getColorTable(palette, true);
287
- case 'greys':
288
- return getColorTable(palette, false);
289
-
290
- default:
291
- // return draclassic palette with only 30 colors
292
- for (let i = 1; i < 30; i++)
293
- colors.push(genDRAColor(i, true));
294
- return colors;
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;
295
280
  }
281
+
282
+ return getColorTable(palette);
296
283
  }
297
284
 
298
285
  const DistrictsColorOrder: number[] =
@@ -313,7 +300,7 @@ function orderedColors(palette: string): string[]
313
300
  return OrderedColorTable[palette];
314
301
  }
315
302
 
316
- export const defaultDistrictsPalette = 'jet';
303
+ export const defaultDistrictsPalette = 'jet_r';
317
304
 
318
305
  // DRA classic color palette
319
306
  export function genDRAColor(i: number, useFirstColor: boolean): string
@@ -339,7 +326,7 @@ export function genDRAColor(i: number, useFirstColor: boolean): string
339
326
  }
340
327
 
341
328
  // Generate table for palette
342
- function getColorTable(palette: string, reverse: boolean): string[]
329
+ function getColorTable(palette: string): string[]
343
330
  {
344
331
  if (palette === 'demographicsclassic')
345
332
  {
@@ -362,9 +349,6 @@ function getColorTable(palette: string, reverse: boolean): string[]
362
349
  return ColorTable[palette];
363
350
  }
364
351
 
365
- if (reverse && !palette.endsWith('_r'))
366
- palette = palette + '_r';
367
-
368
352
  if (allPaletteNames.includes(palette))
369
353
  {
370
354
  if (!ColorTable[palette])
@@ -386,7 +370,7 @@ function jscolormap(name: string, shades: number): string[]
386
370
  let result: string[] = [];
387
371
  for (let i = 0; i < shades; i++)
388
372
  {
389
- const rgb: number[] = partial(name)((i + 0.5) / shades); //evaluate_cmap((i + 0.5) / shades, name, reverse);
373
+ const rgb: number[] = partial(name)((i + 0.5) / shades);
390
374
  result.push(toHexColor(rgb[0], rgb[1], rgb[2]));
391
375
  }
392
376
  return result;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dra2020/baseclient",
3
- "version": "1.0.68",
3
+ "version": "1.0.69",
4
4
  "description": "Utility functions for Javascript projects.",
5
5
  "main": "dist/baseclient.js",
6
6
  "types": "./dist/all/all.d.ts",