Skip to content

Commit 806da06

Browse files
committedJan 12, 2022
feat(core): add support for legends ticks to nivo theme
1 parent 22f2bf7 commit 806da06

File tree

4 files changed

+62
-0
lines changed

4 files changed

+62
-0
lines changed
 

‎packages/core/index.d.ts

+14
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,13 @@ declare module '@nivo/core' {
8787
text: Partial<React.CSSProperties>
8888
}
8989
text: Partial<React.CSSProperties>
90+
ticks: {
91+
line: Partial<React.CSSProperties>
92+
text: Partial<React.CSSProperties>
93+
}
94+
title: {
95+
text: Partial<React.CSSProperties>
96+
}
9097
}
9198
labels: {
9299
text: Partial<React.CSSProperties>
@@ -165,6 +172,13 @@ declare module '@nivo/core' {
165172
text: CompleteTheme['legends']['hidden']['text']
166173
}>
167174
text: Partial<CompleteTheme['legends']['text']>
175+
ticks: Partial<{
176+
line: Partial<CompleteTheme['legends']['ticks']['line']>
177+
text: Partial<CompleteTheme['legends']['ticks']['text']>
178+
}>
179+
title: Partial<{
180+
text: Partial<CompleteTheme['legends']['title']['text']>
181+
}>
168182
}>
169183
labels: Partial<{
170184
text: Partial<CompleteTheme['labels']['text']>

‎packages/core/src/theming/defaultTheme.js

+12
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,18 @@ export const defaultTheme = {
4949
},
5050
},
5151
text: {},
52+
ticks: {
53+
line: {
54+
stroke: '#777777',
55+
strokeWidth: 1,
56+
},
57+
text: {
58+
fontSize: 10,
59+
},
60+
},
61+
title: {
62+
text: {},
63+
},
5264
},
5365
labels: {
5466
text: {},

‎packages/core/src/theming/extend.js

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ const fontProps = [
1414
'axis.ticks.text',
1515
'axis.legend.text',
1616
'legends.text',
17+
'legends.ticks.text',
18+
'legends.title.text',
1719
'labels.text',
1820
'dots.text',
1921
'markers.text',

‎website/src/theming/theme.ts

+34
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,23 @@ const lightTheme: DefaultTheme = {
7979
text: {
8080
fontSize: 12,
8181
},
82+
ticks: {
83+
line: {
84+
strokeWidth: 1,
85+
stroke: '#637079',
86+
},
87+
text: {
88+
fill: '#6a7c89',
89+
fontSize: 10,
90+
},
91+
},
92+
title: {
93+
text: {
94+
fill: '#6f6f6f',
95+
fontSize: 10,
96+
fontWeight: 800,
97+
},
98+
},
8299
},
83100
tooltip: {
84101
container: {
@@ -198,6 +215,23 @@ const darkTheme: DefaultTheme = {
198215
fontSize: 12,
199216
fill: '#8d9cab',
200217
},
218+
ticks: {
219+
line: {
220+
strokeWidth: 1,
221+
stroke: '#c8d4e0',
222+
},
223+
text: {
224+
fill: '#8d9cab',
225+
fontSize: 10,
226+
},
227+
},
228+
title: {
229+
text: {
230+
fill: '#ccd7e2',
231+
fontSize: 10,
232+
fontWeight: 800,
233+
},
234+
},
201235
},
202236
tooltip: {
203237
container: {

0 commit comments

Comments
 (0)
Please sign in to comment.