aboutsummaryrefslogtreecommitdiffstats
path: root/_static/changelog.js
diff options
context:
space:
mode:
authorGravatar HassanAbouelela <[email protected]>2021-12-06 17:21:42 +0000
committerGravatar HassanAbouelela <[email protected]>2021-12-06 17:21:42 +0000
commit2ee87c79bb390afe29139229ce83aace87f807fc (patch)
tree430e8e7e74e2fa049b756fc9b63b0eabca6c307f /_static/changelog.js
parentInitial docs commit (diff)
Deploying to docs from @ python-discord/bot-core@cfe4d495f7e9581fe58576cdf5e5dd9a490e52ed 🚀
Diffstat (limited to '_static/changelog.js')
-rw-r--r--_static/changelog.js37
1 files changed, 37 insertions, 0 deletions
diff --git a/_static/changelog.js b/_static/changelog.js
new file mode 100644
index 00000000..f72d025c
--- /dev/null
+++ b/_static/changelog.js
@@ -0,0 +1,37 @@
+/** Update the changelog colors in dark mode */
+
+const changelog = document.getElementById("changelog");
+
+function updateEntryColor(entry) {
+ const line = entry.lastChild;
+ const lightColorSpan = line.childNodes.item(1);
+ const darkColorSpan = lightColorSpan.cloneNode(true);
+
+ line.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 = null;
+ }
+
+ darkColorSpan.style["color"] = color;
+}
+
+if (changelog !== null) {
+ for (let collection of changelog.getElementsByClassName("simple")) {
+ Array.from(collection.children).forEach(updateEntryColor);
+ }
+}