victory-core 37.1.2 → 37.3.0

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.
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.getColorScale = getColorScale;
7
7
  exports.toTransformString = void 0;
8
+ var _victoryTheme = require("../victory-theme/victory-theme");
8
9
  /**
9
10
  * Given an object with CSS/SVG transform definitions, return the string value
10
11
  * for use with the `transform` CSS property or SVG attribute. Note that we
@@ -41,19 +42,36 @@ const toTransformString = function (obj) {
41
42
  * of 5 hex string values in that color scale. If no 'name' parameter
42
43
  * is given, it will return the Victory default grayscale.
43
44
  * @param {String} name The name of the color scale to return (optional).
45
+ * @param {Object} theme The theme object to retrieve the color scale from (optional).
44
46
  * @returns {Array} An array of 5 hex string values composing a color scale.
45
47
  */
46
48
  exports.toTransformString = toTransformString;
47
- function getColorScale(name) {
49
+ function getColorScale(name, theme) {
50
+ if (theme === void 0) {
51
+ theme = _victoryTheme.VictoryTheme.material;
52
+ }
53
+ const {
54
+ palette: {
55
+ grayscale = ["#cccccc", "#969696", "#636363", "#252525"],
56
+ qualitative = [],
57
+ heatmap = [],
58
+ warm = [],
59
+ cool = [],
60
+ red = [],
61
+ blue = [],
62
+ green = []
63
+ } = {}
64
+ } = theme;
48
65
  const scales = {
49
- grayscale: ["#cccccc", "#969696", "#636363", "#252525"],
50
- qualitative: ["#334D5C", "#45B29D", "#EFC94C", "#E27A3F", "#DF5A49", "#4F7DA1", "#55DBC1", "#EFDA97", "#E2A37F", "#DF948A"],
51
- heatmap: ["#428517", "#77D200", "#D6D305", "#EC8E19", "#C92B05"],
52
- warm: ["#940031", "#C43343", "#DC5429", "#FF821D", "#FFAF55"],
53
- cool: ["#2746B9", "#0B69D4", "#2794DB", "#31BB76", "#60E83B"],
54
- red: ["#FCAE91", "#FB6A4A", "#DE2D26", "#A50F15", "#750B0E"],
55
- blue: ["#002C61", "#004B8F", "#006BC9", "#3795E5", "#65B4F4"],
56
- green: ["#354722", "#466631", "#649146", "#8AB25C", "#A9C97E"]
66
+ grayscale,
67
+ qualitative,
68
+ heatmap,
69
+ warm,
70
+ cool,
71
+ red,
72
+ blue,
73
+ green
57
74
  };
58
- return name ? scales[name] : scales.grayscale;
75
+ const selectedScale = name && scales[name]?.length ? scales[name] : scales.grayscale;
76
+ return selectedScale;
59
77
  }
@@ -14,10 +14,10 @@ export declare function getDomainFromChildren(props: any, axis: any, childCompon
14
14
  export declare function getDomain(props: any, axis: any, childComponents: any): any;
15
15
  export declare function getScale(props: any, axis: any, childComponents?: any): import("..").D3Scale<any>;
16
16
  export declare function getAllEvents(props: any): any;
17
- export declare function getColor(calculatedProps: any, child: any, index: any): any;
17
+ export declare function getColor(calculatedProps: any, child: any, index: any, theme: any): any;
18
18
  export declare function getStyle(theme: any, style: any, role: any): any;
19
- export declare function getChildStyle(child: any, index: any, calculatedProps: any): any;
20
- export declare function getStringsFromCategories(childComponents: any, axis: any): any[];
19
+ export declare function getChildStyle(child: any, index: any, calculatedProps: any, theme: any): any;
20
+ export declare function getStringsFromChildrenCategories(childComponents: any, axis: any): any[];
21
21
  export declare function getStringsFromData(childComponents: any): {
22
22
  x: number[];
23
23
  y: number[];
@@ -15,12 +15,11 @@ exports.getDefaultDomainPadding = getDefaultDomainPadding;
15
15
  exports.getDomain = getDomain;
16
16
  exports.getDomainFromChildren = getDomainFromChildren;
17
17
  exports.getScale = getScale;
18
- exports.getStringsFromCategories = getStringsFromCategories;
19
18
  exports.getStringsFromChildren = getStringsFromChildren;
19
+ exports.getStringsFromChildrenCategories = getStringsFromChildrenCategories;
20
20
  exports.getStringsFromData = getStringsFromData;
21
21
  exports.getStyle = getStyle;
22
22
  exports.getWidth = getWidth;
23
- var _isPlainObject2 = _interopRequireDefault(require("lodash/isPlainObject"));
24
23
  var _uniqBy2 = _interopRequireDefault(require("lodash/uniqBy"));
25
24
  var _groupBy2 = _interopRequireDefault(require("lodash/groupBy"));
26
25
  var _uniq2 = _interopRequireDefault(require("lodash/uniq"));
@@ -279,7 +278,9 @@ function getAllEvents(props) {
279
278
  }
280
279
  return events || [];
281
280
  }
282
- function getColor(calculatedProps, child, index) {
281
+
282
+ // eslint-disable-next-line max-params
283
+ function getColor(calculatedProps, child, index, theme) {
283
284
  // check for styles first
284
285
  const {
285
286
  style
@@ -296,14 +297,16 @@ function getColor(calculatedProps, child, index) {
296
297
  if (!colorScale && !color) {
297
298
  return undefined;
298
299
  }
299
- const colors = Array.isArray(colorScale) ? colorScale : Style.getColorScale(colorScale);
300
+ const colors = Array.isArray(colorScale) ? colorScale : Style.getColorScale(colorScale, theme);
300
301
  return color || colors[index % colors.length];
301
302
  }
302
303
  function getStyle(theme, style, role) {
303
304
  const defaultStyle = theme && theme[role] && theme[role].style ? theme[role].style : {};
304
305
  return Helpers.getStyles(style, defaultStyle);
305
306
  }
306
- function getChildStyle(child, index, calculatedProps) {
307
+
308
+ // eslint-disable-next-line max-params
309
+ function getChildStyle(child, index, calculatedProps, theme) {
307
310
  const {
308
311
  style,
309
312
  role
@@ -313,7 +316,7 @@ function getChildStyle(child, index, calculatedProps) {
313
316
  return childStyle;
314
317
  }
315
318
  const childRole = child.type && child.type.role;
316
- const defaultFill = childRole === "stack" ? undefined : getColor(calculatedProps, child, index);
319
+ const defaultFill = childRole === "stack" ? undefined : getColor(calculatedProps, child, index, theme);
317
320
  const defaultColor = childRole === "line" ? {
318
321
  fill: "none",
319
322
  stroke: defaultFill
@@ -332,15 +335,13 @@ function getChildStyle(child, index, calculatedProps) {
332
335
  labels: labelsStyle
333
336
  };
334
337
  }
335
- function getStringsFromCategories(childComponents, axis) {
338
+ function getStringsFromChildrenCategories(childComponents, axis) {
336
339
  const iteratee = child => {
337
- const childProps = child.props || {};
338
- if (!Domain.isDomainComponent(child) || !childProps.categories) {
340
+ if (!Domain.isDomainComponent(child)) {
339
341
  return null;
340
342
  }
341
- const categories = childProps.categories && !Array.isArray(childProps.categories) ? childProps.categories[axis] : childProps.props.categories;
342
- const categoryStrings = categories && categories.filter(val => typeof val === "string");
343
- return categoryStrings ? Collection.removeUndefined(categoryStrings) : [];
343
+ const childProps = child.props || {};
344
+ return Data.getStringsFromCategories(childProps, axis);
344
345
  };
345
346
  return Helpers.reduceChildren(childComponents.slice(0), iteratee);
346
347
  }
@@ -375,10 +376,10 @@ function getStringsFromData(childComponents) {
375
376
  return Helpers.reduceChildren(childComponents.slice(0), iteratee, {}, initialMemo, combine);
376
377
  }
377
378
  function getCategoryAndAxisStringsFromChildren(props, axis, childComponents) {
378
- const categories = (0, _isPlainObject2.default)(props.categories) ? props.categories[axis] : props.categories;
379
+ const categories = Data.getStringsFromCategories(props, axis);
379
380
  const axisComponent = Axis.getAxisComponent(childComponents, axis);
380
381
  const axisStrings = axisComponent ? Data.getStringsFromAxes(axisComponent.props, axis) : [];
381
- const categoryStrings = categories || getStringsFromCategories(childComponents, axis);
382
+ const categoryStrings = categories.length ? categories : getStringsFromChildrenCategories(childComponents, axis);
382
383
  return (0, _uniq2.default)([...categoryStrings, ...axisStrings].flat());
383
384
  }
384
385
  function getStringsFromChildren(props, childComponents) {
@@ -392,8 +393,8 @@ function getStringsFromChildren(props, childComponents) {
392
393
  };
393
394
  }
394
395
  function getCategories(props, childComponents, allStrings) {
395
- const xPropCategories = props.categories && !Array.isArray(props.categories) ? props.categories.x : props.categories;
396
- const yPropCategories = props.categories && !Array.isArray(props.categories) ? props.categories.y : props.categories;
396
+ const xPropCategories = props.categories && Data.getStringsFromCategories(props, "x");
397
+ const yPropCategories = props.categories && Data.getStringsFromCategories(props, "y");
397
398
  const fallbackRequired = !xPropCategories || !yPropCategories;
398
399
  const fallbackProps = fallbackRequired ? allStrings || getStringsFromChildren(props, childComponents) : {};
399
400
  const xCategories = xPropCategories || fallbackProps.x;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "victory-core",
3
- "version": "37.1.2",
3
+ "version": "37.3.0",
4
4
  "description": "Victory Core",
5
5
  "keywords": [
6
6
  "data visualization",
@@ -22,7 +22,7 @@
22
22
  "dependencies": {
23
23
  "lodash": "^4.17.21",
24
24
  "react-fast-compare": "^3.2.0",
25
- "victory-vendor": "37.1.2"
25
+ "victory-vendor": "37.3.0"
26
26
  },
27
27
  "peerDependencies": {
28
28
  "react": ">=16.6.0"
@@ -42,6 +42,7 @@ export interface Padding {
42
42
 
43
43
  export interface AnimatePropTypeInterface {
44
44
  duration?: number;
45
+ delay?: number;
45
46
  onEnd?: () => void;
46
47
  onExit?: {
47
48
  duration?: number;
@@ -1,5 +1,5 @@
1
- import React from "react";
2
- import { defaults } from "lodash";
1
+ import React, { useState } from "react";
2
+ import { defaults, uniqueId } from "lodash";
3
3
  import * as Log from "../victory-util/log";
4
4
  import * as Helpers from "../victory-util/helpers";
5
5
  import { usePortalContext } from "./portal-context";
@@ -15,7 +15,7 @@ const defaultProps: Partial<VictoryPortalProps> = {
15
15
 
16
16
  export const VictoryPortal = (initialProps: VictoryPortalProps) => {
17
17
  const props = { ...defaultProps, ...initialProps };
18
- const id = React.useId();
18
+ const [id] = useState(uniqueId());
19
19
  const portalContext = usePortalContext();
20
20
 
21
21
  if (!portalContext) {
@@ -28,20 +28,16 @@ const orange = {
28
28
  "100": "#FEE2D5",
29
29
  "300": "#FFA981",
30
30
  "500": "#FF6F2C",
31
+ "700": "#FF4E1B",
31
32
  "900": "#D74D26",
32
33
  };
33
34
  const red = {
34
35
  "100": "#FFDCE5",
35
36
  "300": "#FF9EB7",
36
37
  "500": "#F82B60",
38
+ "700": "#D31A3D",
37
39
  "900": "#BA1E45",
38
40
  };
39
- const pink = {
40
- "100": "#FFDAF6",
41
- "300": "#F99DE2",
42
- "500": "#FF08C2",
43
- "900": "#B2158B",
44
- };
45
41
  const purple = {
46
42
  "100": "#EDE3FE",
47
43
  "300": "#CDB0FF",
@@ -52,6 +48,7 @@ const blue = {
52
48
  "100": "#CFDFFF",
53
49
  "300": "#9CC7FF",
54
50
  "500": "#2D7FF9",
51
+ "700": "#0056B3",
55
52
  "900": "#2750AE",
56
53
  };
57
54
  const cyan = {
@@ -70,20 +67,56 @@ const green = {
70
67
  "100": "#D1F7C4",
71
68
  "300": "#93E088",
72
69
  "500": "#20C933",
70
+ "700": "#1B9B2A",
73
71
  "900": "#338A17",
74
72
  };
75
73
 
76
- const colors = [
74
+ const colors = {
75
+ blue: blue["500"],
76
+ cyan: cyan["500"],
77
+ green: green["500"],
78
+ yellow: yellow["500"],
79
+ orange: orange["500"],
80
+ red: red["500"],
81
+ purple: purple["500"],
82
+ teal: teal["500"],
83
+ };
84
+
85
+ const colorScale = Object.values(colors);
86
+ const grayscale = [
87
+ gray["100"],
88
+ gray["300"],
89
+ gray["500"],
90
+ gray["700"],
91
+ gray["900"],
92
+ ];
93
+ const warm = [
94
+ yellow["300"],
95
+ yellow["500"],
96
+ orange["500"],
97
+ orange["900"],
98
+ red["500"],
99
+ ];
100
+ const cool = [
101
+ purple["500"],
77
102
  blue["500"],
78
- pink["500"],
103
+ cyan["500"],
79
104
  teal["500"],
80
- purple["500"],
81
105
  green["500"],
106
+ ];
107
+ const heatmap = [
108
+ green["900"],
109
+ green["500"],
110
+ yellow["500"],
82
111
  orange["500"],
83
- cyan["500"],
84
112
  red["500"],
85
- yellow["500"],
86
113
  ];
114
+ const redPalette = Object.values(red);
115
+ const greenPalette = Object.values(green);
116
+ const bluePalette = Object.values(blue);
117
+
118
+ const defaultColor = blue["500"];
119
+
87
120
  // *
88
121
  // * Typography
89
122
  // *
@@ -98,8 +131,8 @@ const padding = 8;
98
131
  const baseProps = {
99
132
  width: 450,
100
133
  height: 300,
101
- padding: 50,
102
- colorScale: colors,
134
+ padding: 60,
135
+ colorScale,
103
136
  };
104
137
  // *
105
138
  // * Labels
@@ -130,11 +163,24 @@ const borderRadius = 1;
130
163
  // * Theme
131
164
  // *
132
165
  export const clean: VictoryThemeDefinition = {
166
+ palette: {
167
+ colors,
168
+ grayscale,
169
+ qualitative: colorScale,
170
+ heatmap,
171
+ warm,
172
+ cool,
173
+ red: redPalette,
174
+ green: greenPalette,
175
+ blue: bluePalette,
176
+ },
133
177
  area: Object.assign(
134
178
  {
135
179
  style: {
136
180
  data: {
137
- fill: cyan["500"],
181
+ fill: defaultColor,
182
+ strokeWidth: 2,
183
+ fillOpacity: 0.5,
138
184
  },
139
185
  labels: baseLabelStyles,
140
186
  },
@@ -146,13 +192,13 @@ export const clean: VictoryThemeDefinition = {
146
192
  style: {
147
193
  axis: {
148
194
  fill: "transparent",
149
- stroke: gray["300"],
195
+ stroke: gray["500"],
150
196
  strokeWidth: 1,
151
197
  strokeLinecap,
152
198
  strokeLinejoin,
153
199
  },
154
200
  axisLabel: Object.assign({}, centeredLabelStyles, {
155
- padding,
201
+ padding: 35,
156
202
  stroke: "transparent",
157
203
  }),
158
204
  grid: {
@@ -173,10 +219,10 @@ export const clean: VictoryThemeDefinition = {
173
219
  polarAxis: Object.assign({
174
220
  style: {
175
221
  axis: {
176
- stroke: gray["300"],
222
+ stroke: gray["500"],
177
223
  },
178
224
  grid: {
179
- stroke: gray["200"],
225
+ stroke: gray["400"],
180
226
  strokeDasharray,
181
227
  strokeLinecap,
182
228
  strokeLinejoin,
@@ -185,7 +231,7 @@ export const clean: VictoryThemeDefinition = {
185
231
  ticks: {
186
232
  fill: "transparent",
187
233
  size: 5,
188
- stroke: gray["200"],
234
+ stroke: gray["400"],
189
235
  strokeWidth: 1,
190
236
  strokeLinecap,
191
237
  strokeLinejoin,
@@ -196,10 +242,10 @@ export const clean: VictoryThemeDefinition = {
196
242
  polarDependentAxis: Object.assign({
197
243
  style: {
198
244
  axis: {
199
- stroke: gray["300"],
245
+ stroke: gray["500"],
200
246
  },
201
247
  grid: {
202
- stroke: gray["200"],
248
+ stroke: gray["400"],
203
249
  strokeDasharray,
204
250
  strokeLinecap,
205
251
  strokeLinejoin,
@@ -208,7 +254,7 @@ export const clean: VictoryThemeDefinition = {
208
254
  ticks: {
209
255
  fill: "transparent",
210
256
  size: 5,
211
- stroke: gray["200"],
257
+ stroke: gray["300"],
212
258
  strokeWidth: 1,
213
259
  strokeLinecap,
214
260
  strokeLinejoin,
@@ -220,9 +266,10 @@ export const clean: VictoryThemeDefinition = {
220
266
  {
221
267
  style: {
222
268
  data: {
223
- fill: blue["500"],
269
+ fill: defaultColor,
224
270
  padding,
225
- strokeWidth: 0,
271
+ strokeWidth: 1,
272
+ fillOpacity: 0.5,
226
273
  },
227
274
  labels: baseLabelStyles,
228
275
  },
@@ -239,9 +286,9 @@ export const clean: VictoryThemeDefinition = {
239
286
  medianLabels: Object.assign({}, baseLabelStyles, { padding: 3 }),
240
287
  min: { padding, stroke: gray["400"], strokeWidth: 2 },
241
288
  minLabels: Object.assign({}, baseLabelStyles, { padding: 3 }),
242
- q1: { padding, fill: teal["500"], rx: borderRadius },
289
+ q1: { padding, fill: colorScale[0], rx: borderRadius, strokeWidth: 2 },
243
290
  q1Labels: Object.assign({}, baseLabelStyles, { padding: 3 }),
244
- q3: { padding, fill: teal["500"], rx: borderRadius },
291
+ q3: { padding, fill: colorScale[1], rx: borderRadius },
245
292
  q3Labels: Object.assign({}, baseLabelStyles, { padding: 3 }),
246
293
  },
247
294
  boxWidth: 20,
@@ -259,8 +306,8 @@ export const clean: VictoryThemeDefinition = {
259
306
  labels: Object.assign({}, baseLabelStyles, { padding: 5 }),
260
307
  },
261
308
  candleColors: {
262
- positive: teal["500"],
263
- negative: orange["500"],
309
+ positive: green["500"],
310
+ negative: red["500"],
264
311
  },
265
312
  wickStrokeWidth: 2,
266
313
  },
@@ -285,7 +332,7 @@ export const clean: VictoryThemeDefinition = {
285
332
  ),
286
333
  group: Object.assign(
287
334
  {
288
- colorScale: colors,
335
+ colorScale,
289
336
  },
290
337
  baseProps,
291
338
  ),
@@ -294,8 +341,7 @@ export const clean: VictoryThemeDefinition = {
294
341
  style: {
295
342
  data: {
296
343
  fill: cyan["500"],
297
- stroke: "transparent",
298
- strokeWidth: 0,
344
+ fillOpacity: 0.5,
299
345
  },
300
346
  labels: baseLabelStyles,
301
347
  },
@@ -306,16 +352,18 @@ export const clean: VictoryThemeDefinition = {
306
352
  ),
307
353
  label: baseLabelStyles,
308
354
  legend: {
309
- colorScale: colors,
310
- gutter: 10,
311
- orientation: "vertical",
355
+ colorScale,
356
+ gutter: 24,
357
+ borderPadding: 10,
358
+ orientation: "horizontal",
312
359
  titleOrientation: "top",
360
+ centerTitle: true,
313
361
  style: {
314
362
  data: {
315
363
  type: "circle",
316
364
  },
317
- labels: { ...baseLabelStyles, fontSize: 14 },
318
- title: Object.assign({}, baseLabelStyles, { padding, fontSize: 20 }),
365
+ labels: { ...baseLabelStyles, fontSize: 12 },
366
+ title: Object.assign({}, baseLabelStyles, { padding, fontSize: 16 }),
319
367
  border: { stroke: gray["200"], strokeWidth: 2, padding: 16 },
320
368
  },
321
369
  },
@@ -325,7 +373,7 @@ export const clean: VictoryThemeDefinition = {
325
373
  data: {
326
374
  fill: "transparent",
327
375
  opacity: 1,
328
- stroke: pink["500"],
376
+ stroke: defaultColor,
329
377
  strokeWidth: 2,
330
378
  strokeLinecap,
331
379
  strokeLinejoin,
@@ -338,14 +386,22 @@ export const clean: VictoryThemeDefinition = {
338
386
  pie: Object.assign(
339
387
  {
340
388
  style: {
389
+ parent: {
390
+ backgroundColor: gray.white,
391
+ },
341
392
  data: {
342
393
  padding,
343
394
  stroke: gray.white,
344
395
  strokeWidth: 1,
345
396
  },
346
- labels: Object.assign({}, baseLabelStyles, { padding: 20 }),
397
+ labels: {
398
+ ...baseLabelStyles,
399
+ padding: 20,
400
+ fill: gray["600"],
401
+ fontSize: 10,
402
+ },
347
403
  },
348
- colorScale: colors,
404
+ colorScale,
349
405
  cornerRadius: borderRadius,
350
406
  },
351
407
  baseProps,
@@ -354,19 +410,22 @@ export const clean: VictoryThemeDefinition = {
354
410
  {
355
411
  style: {
356
412
  data: {
357
- fill: purple["500"],
413
+ fill: defaultColor,
358
414
  opacity: 1,
359
415
  stroke: "transparent",
360
416
  strokeWidth: 0,
361
417
  },
362
- labels: baseLabelStyles,
418
+ labels: {
419
+ ...baseLabelStyles,
420
+ padding: 20,
421
+ },
363
422
  },
364
423
  },
365
424
  baseProps,
366
425
  ),
367
426
  stack: Object.assign(
368
427
  {
369
- colorScale: colors,
428
+ colorScale,
370
429
  },
371
430
  baseProps,
372
431
  ),
@@ -376,7 +435,7 @@ export const clean: VictoryThemeDefinition = {
376
435
  pointerEvents: "none",
377
436
  }),
378
437
  flyoutStyle: {
379
- stroke: gray["500"],
438
+ stroke: gray["300"],
380
439
  strokeWidth: 2,
381
440
  fill: gray.white,
382
441
  pointerEvents: "none",
@@ -389,8 +448,8 @@ export const clean: VictoryThemeDefinition = {
389
448
  {
390
449
  style: {
391
450
  data: {
392
- fill: red["100"],
393
- stroke: red["500"],
451
+ fill: blue["100"],
452
+ stroke: defaultColor,
394
453
  strokeWidth: 2,
395
454
  },
396
455
  labels: Object.assign({}, baseLabelStyles, {
@@ -3,7 +3,19 @@ import { VictoryThemeDefinition } from "./types";
3
3
  // *
4
4
  // * Colors
5
5
  // *
6
- const colors = [
6
+ const colors = {
7
+ blue: "#4F7DA1",
8
+ pink: "#E2A37F",
9
+ teal: "#00796B",
10
+ purple: "#DF948A",
11
+ green: "#8BC34A",
12
+ orange: "#F4511E",
13
+ cyan: "#006064",
14
+ red: "#DF5A49",
15
+ yellow: "#FFF59D",
16
+ };
17
+
18
+ const colorScale = [
7
19
  "#252525",
8
20
  "#525252",
9
21
  "#737373",
@@ -15,6 +27,26 @@ const colors = [
15
27
 
16
28
  const charcoal = "#252525";
17
29
  const grey = "#969696";
30
+
31
+ const qualitative = [
32
+ "#334D5C",
33
+ "#45B29D",
34
+ "#EFC94C",
35
+ "#E27A3F",
36
+ "#DF5A49",
37
+ "#4F7DA1",
38
+ "#55DBC1",
39
+ "#EFDA97",
40
+ "#E2A37F",
41
+ "#DF948A",
42
+ ];
43
+ const heatmap = ["#428517", "#77D200", "#D6D305", "#EC8E19", "#C92B05"];
44
+ const warm = ["#940031", "#C43343", "#DC5429", "#FF821D", "#FFAF55"];
45
+ const cool = ["#2746B9", "#0B69D4", "#2794DB", "#31BB76", "#60E83B"];
46
+ const red = ["#FCAE91", "#FB6A4A", "#DE2D26", "#A50F15", "#750B0E"];
47
+ const green = ["#354722", "#466631", "#649146", "#8AB25C", "#A9C97E"];
48
+ const blue = ["#002C61", "#004B8F", "#006BC9", "#3795E5", "#65B4F4"];
49
+
18
50
  // *
19
51
  // * Typography
20
52
  // *
@@ -28,7 +60,7 @@ const baseProps = {
28
60
  width: 450,
29
61
  height: 300,
30
62
  padding: 50,
31
- colorScale: colors,
63
+ colorScale,
32
64
  };
33
65
  // *
34
66
  // * Labels
@@ -53,6 +85,17 @@ const strokeLinecap = "round";
53
85
  const strokeLinejoin = "round";
54
86
 
55
87
  export const grayscale: VictoryThemeDefinition = {
88
+ palette: {
89
+ colors,
90
+ grayscale: colorScale,
91
+ qualitative,
92
+ heatmap,
93
+ warm,
94
+ cool,
95
+ red,
96
+ green,
97
+ blue,
98
+ },
56
99
  area: Object.assign(
57
100
  {
58
101
  style: {
@@ -156,7 +199,7 @@ export const grayscale: VictoryThemeDefinition = {
156
199
  ),
157
200
  group: Object.assign(
158
201
  {
159
- colorScale: colors,
202
+ colorScale,
160
203
  },
161
204
  baseProps,
162
205
  ),
@@ -174,7 +217,7 @@ export const grayscale: VictoryThemeDefinition = {
174
217
  baseProps,
175
218
  ),
176
219
  legend: {
177
- colorScale: colors,
220
+ colorScale,
178
221
  gutter: 10,
179
222
  orientation: "vertical",
180
223
  titleOrientation: "top",
@@ -208,7 +251,7 @@ export const grayscale: VictoryThemeDefinition = {
208
251
  },
209
252
  labels: Object.assign({}, baseLabelStyles, { padding: 20 }),
210
253
  },
211
- colorScale: colors,
254
+ colorScale,
212
255
  width: 400,
213
256
  height: 400,
214
257
  padding: 50,
@@ -228,7 +271,7 @@ export const grayscale: VictoryThemeDefinition = {
228
271
  ),
229
272
  stack: Object.assign(
230
273
  {
231
- colorScale: colors,
274
+ colorScale,
232
275
  },
233
276
  baseProps,
234
277
  ),