Skip to content

Commit ba04441

Browse files
authoredJun 13, 2024
Merge pull request #4505 from Sebastian-Webster/fix-theme-change
fix: fixed theme change from dark mode to light mode not working
2 parents 9190caa + d47bc72 commit ba04441

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed
 

‎src/modules/Theme.js

+16-10
Original file line numberDiff line numberDiff line change
@@ -178,20 +178,26 @@ export default class Theme {
178178
updateThemeOptions(options) {
179179
options.chart = options.chart || {}
180180
options.tooltip = options.tooltip || {}
181-
const mode = options.theme.mode || 'light'
182-
const palette = options.theme.palette
183-
? options.theme.palette
184-
: mode === 'dark'
181+
const mode = options.theme.mode
182+
const background = mode === 'dark'
183+
? '#424242'
184+
: mode === 'light'
185+
? '#fff'
186+
: options.chart.background || '#fff'
187+
const palette = mode === 'dark'
185188
? 'palette4'
186-
: 'palette1'
187-
const foreColor = options.chart.foreColor
188-
? options.chart.foreColor
189-
: mode === 'dark'
189+
: mode === 'light'
190+
? 'palette1'
191+
: options.theme.palette || 'palette1'
192+
const foreColor = mode === 'dark'
190193
? '#f6f7f8'
191-
: '#373d3f'
194+
: mode === 'light'
195+
? '#373d3f'
196+
: options.chart.foreColor || '#373d3f'
192197

193-
options.tooltip.theme = mode
198+
options.tooltip.theme = mode || 'light'
194199
options.chart.foreColor = foreColor
200+
options.chart.background = background
195201
options.theme.palette = palette
196202

197203
return options

0 commit comments

Comments
 (0)
Please sign in to comment.