diff options
author | 2023-05-06 12:18:06 +0000 | |
---|---|---|
committer | 2023-05-06 12:18:06 +0000 | |
commit | 85bd6652db82865f40b6036a6d74b0354d58c0ec (patch) | |
tree | fd32e7d1945e35033cb5dd5ae4a55fcb88f327d0 /v9.5.1/_static/changelog.js | |
parent | Deploying to docs from @ python-discord/bot-core@79b8734b5cd5c1d9d884a0e21152... (diff) |
Deploying to docs from @ python-discord/bot-core@e92119ede9e2829a530e3137b1722e5f5808d8f5 🚀
Diffstat (limited to 'v9.5.1/_static/changelog.js')
-rw-r--r-- | v9.5.1/_static/changelog.js | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/v9.5.1/_static/changelog.js b/v9.5.1/_static/changelog.js new file mode 100644 index 00000000..94834eaa --- /dev/null +++ b/v9.5.1/_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(); |