From 505786434e86c39cddb75d50d356385a0b35f8a1 Mon Sep 17 00:00:00 2001 From: Derek Chen Date: Thu, 28 Dec 2023 14:08:37 -0600 Subject: [PATCH] Took a while but I think I got the font color of charts to change as well --- docs/colorScheme.js | 4 +++- docs/main.js | 1 - 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/colorScheme.js b/docs/colorScheme.js index 9f52185..6f795fd 100644 --- a/docs/colorScheme.js +++ b/docs/colorScheme.js @@ -1,4 +1,6 @@ const colorToggle = document.getElementById("colorToggle") colorToggle.addEventListener("change", () => { - document.body.classList.toggle("dark") + const darkModeEnabled = document.body.classList.toggle("dark"); + Chart.defaults.global.defaultFontColor = darkModeEnabled ? "#484b6a" : "#F8F0E5"; + // Chart.defaults.plugins.legend.labels.color = isDarkModeEnabled ? "#484b6a" : "#F8F0E5"; }) \ No newline at end of file diff --git a/docs/main.js b/docs/main.js index 1e763a7..c1e0e7a 100644 --- a/docs/main.js +++ b/docs/main.js @@ -166,7 +166,6 @@ function createChart(gradeDist, courseName) { options: { legend: { labels: { - fontColor: "#F8F0E5", fontSize: 15 } },