You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi @rogerfar, you can easily implement dark mode yourself by passing the following options when creating your chart (for a pie chart in this case):
let options = {
theme: {
chart: {
backgroundColor: 'transparent'
},
legend: {
label: {
color: 'white'
}
}
}
}
let chart = new PieChart({
el: el,
data: data,
options: options
});
If you want to monitor mode/theme changes:
let theme = window.matchMedia("(prefers-color-scheme: dark)");
const applyTheme = (isDarkMode) => {
options.theme.legend.label.color = isDarkMode ? "white" : "black";
chart.setOptions(options);
}
// apply theme right after we draw the chart
applyTheme(theme.matches);
// monitor theme changes and apply the new theme
theme.addEventListener("change", e => {
applyTheme(e.matches);
});
Is it possible to add a dark mode? Or should we manually change the background color?
The text was updated successfully, but these errors were encountered: