This repository has been archived by the owner on Feb 8, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
theme.js
executable file
·99 lines (93 loc) · 1.76 KB
/
theme.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
import deepClone from 'lodash/cloneDeep';
export const defaultTheme = {
range: {
dotSize: [20, 250],
category20: [
'#3BB2D0',
'#2C75B0',
'#FAB72E',
'#EF4848',
'#65B60D',
'#C32D7B',
'#F577B9',
'#5FD2B8',
'#F1800F',
'#9F1C00',
'#A5E9E3',
'#B9D765',
'#393F44',
'#CACCD0',
'#717171'
],
ordinal: { scheme: 'greens' },
ramp: { scheme: 'purples' }
},
axis: {
labelFontSize: 13,
labelFont: 'Lato',
labelColor: '#717171',
labelPadding: 10,
ticks: true,
tickSize: 8,
tickColor: '#A9ABAD',
tickOpacity: 0.5,
tickExtra: false
},
axisX: {
bandPosition: 0.5,
domainWidth: 1.2,
domainColor: '#A9ABAD',
labelAlign: 'center',
labelBaseline: 'top'
},
axisY: {
domain: false,
labelAlign: 'left',
labelBaseline: 'bottom',
tickOpacity: 0.5,
grid: true,
ticks: false,
gridColor: '#A9ABAD',
gridOpacity: 0.5
},
mark: {
fill: '#3BB2D0'
},
symbol: {
fill: '#3BB2D0',
stroke: '#fff'
},
rect: {
fill: '#3BB2D0'
},
line: {
interpolate: 'linear',
stroke: '#3BB2D0',
fillOpacity: 0
}
};
/**
* Return the theme of the vega chart
* @param {boolean} [thumbnail=false]
* @return {object}
*/
export default function (thumbnail = false) {
const theme = deepClone(defaultTheme);
if (thumbnail) {
// We remove the configuration of each of
// the axes
delete theme.axisX;
delete theme.axisY;
// We reduce the size of the dots
theme.range.dotSize = [10, 150];
// We hide the axes and their ticks and
// labels
theme.axis = {
ticks: false,
labels: false,
grid: false,
domainWidth: 0
};
}
return theme;
}