aboutsummaryrefslogtreecommitdiffstats
path: root/v10.4.0/_static/changelog.js
diff options
context:
space:
mode:
authorGravatar ChrisLovering <[email protected]>2023-12-10 16:00:28 +0000
committerGravatar ChrisLovering <[email protected]>2023-12-10 16:00:28 +0000
commit98fe8707d983ef4b9f10cab28a1a540b8dafc078 (patch)
tree796d088be34e549f3da0be817c15c7a7c46876a2 /v10.4.0/_static/changelog.js
parentDeploying to docs from @ python-discord/bot-core@ee2501e36aa4cb6e809de9873e3d... (diff)
Deploying to docs from @ python-discord/bot-core@3ed1d4be2328b59577afde058105fd071184bd95 🚀
Diffstat (limited to 'v10.4.0/_static/changelog.js')
-rw-r--r--v10.4.0/_static/changelog.js41
1 files changed, 41 insertions, 0 deletions
diff --git a/v10.4.0/_static/changelog.js b/v10.4.0/_static/changelog.js
new file mode 100644
index 00000000..94834eaa
--- /dev/null
+++ b/v10.4.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();