aboutsummaryrefslogtreecommitdiffstats
path: root/v11.5.0/_static/changelog.js
diff options
context:
space:
mode:
authorGravatar ChrisLovering <[email protected]>2024-11-23 18:47:50 +0000
committerGravatar ChrisLovering <[email protected]>2024-11-23 18:47:50 +0000
commit4497a82c504818d61ab18c5251ae2bc42bae279e (patch)
tree787e4916831cac5ae07115fdf2b2bcc49f0a04e0 /v11.5.0/_static/changelog.js
parentDeploying to docs from @ python-discord/bot-core@06b1ada5772490e18a7ab1b96d05... (diff)
Deploying to docs from @ python-discord/bot-core@bdaaa2e76d4cb32843754757532ef8d73ac97761 🚀
Diffstat (limited to 'v11.5.0/_static/changelog.js')
-rw-r--r--v11.5.0/_static/changelog.js41
1 files changed, 41 insertions, 0 deletions
diff --git a/v11.5.0/_static/changelog.js b/v11.5.0/_static/changelog.js
new file mode 100644
index 00000000..94834eaa
--- /dev/null
+++ b/v11.5.0/_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();