aboutsummaryrefslogtreecommitdiffstats
path: root/docs/_static/changelog.js
diff options
context:
space:
mode:
authorGravatar ChrisJL <[email protected]>2022-05-30 19:10:35 +0100
committerGravatar GitHub <[email protected]>2022-05-30 19:10:35 +0100
commit6659680429eec1dd0d45a6332a329a8b5e5a0d0b (patch)
treeb5b1c6133f8f56e4788d119c3c9378c670137054 /docs/_static/changelog.js
parentMerge pull request #78 from python-discord/bump-d.py (diff)
parentFix Bullet Points In Changelog (diff)
Merge pull request #79 from python-discord/upgrade-docsv7.1.1
Diffstat (limited to 'docs/_static/changelog.js')
-rw-r--r--docs/_static/changelog.js41
1 files changed, 41 insertions, 0 deletions
diff --git a/docs/_static/changelog.js b/docs/_static/changelog.js
new file mode 100644
index 00000000..94834eaa
--- /dev/null
+++ b/docs/_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();