aboutsummaryrefslogtreecommitdiffstats
path: root/v9.9.2/_static/changelog.js
diff options
context:
space:
mode:
authorGravatar ChrisLovering <[email protected]>2023-07-10 20:18:31 +0000
committerGravatar ChrisLovering <[email protected]>2023-07-10 20:18:31 +0000
commit9cd3189ebf1e8016e12719d2808932a6bc997387 (patch)
tree6b63b0a92a93f9b716608ddd6f15d2bf4ad19038 /v9.9.2/_static/changelog.js
parentDeploying to docs from @ python-discord/bot-core@f80a263bfc024eade1c35b336128... (diff)
Deploying to docs from @ python-discord/bot-core@4c1060a334301265dd8b620c91a815a5ed72bb34 🚀
Diffstat (limited to 'v9.9.2/_static/changelog.js')
-rw-r--r--v9.9.2/_static/changelog.js41
1 files changed, 41 insertions, 0 deletions
diff --git a/v9.9.2/_static/changelog.js b/v9.9.2/_static/changelog.js
new file mode 100644
index 00000000..94834eaa
--- /dev/null
+++ b/v9.9.2/_static/changelog.js
@@ -0,0 +1,41 @@
+/** Update the changelog colors in dark mode */
+function changelog_color_main() {
+ const changelog = document.getElementById("changelog");
+
+ function updateEntryColor(span) {
+ const lightColorSpan = span;
+ const darkColorSpan = lightColorSpan.cloneNode(true);
+
+ lightColorSpan.parentElement.insertBefore(darkColorSpan, lightColorSpan);
+
+ lightColorSpan.classList.add("light");
+ darkColorSpan.classList.add("dark");
+
+ let color;
+ switch (darkColorSpan.textContent) {
+ case "Feature":
+ color = "#5BF38E";
+ break;
+ case "Support":
+ color = "#55A5E7";
+ break;
+ case "Bug":
+ color = "#E14F4F";
+ break;
+ default:
+ color = lightColorSpan.style.color;
+ }
+
+ darkColorSpan.style["color"] = color;
+ }
+
+ const TYPES = ["Feature", "Bug", "Support", "Breaking"];
+
+ if (changelog !== null) {
+ Array.from(changelog.getElementsByTagName("span"))
+ .filter(value => TYPES.includes(value.textContent))
+ .forEach(updateEntryColor)
+ }
+}
+
+changelog_color_main();