diff options
author | 2025-07-13 20:44:31 +0000 | |
---|---|---|
committer | 2025-07-13 20:44:31 +0000 | |
commit | 8d6175dfa55aba7256ce299e25e4d5470b9a8435 (patch) | |
tree | 0c71b75a1ae8d20d58cd525c4ab2aaad9e70a106 /v11.6.1/_static/changelog.js | |
parent | Deploying to docs from @ python-discord/bot-core@7a0f529835ec5f3f09b0924848e0... (diff) |
Deploying to docs from @ python-discord/bot-core@eecf9521fe1c7f5629def226f5416e014f8a7fcf 🚀
Diffstat (limited to 'v11.6.1/_static/changelog.js')
-rw-r--r-- | v11.6.1/_static/changelog.js | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/v11.6.1/_static/changelog.js b/v11.6.1/_static/changelog.js new file mode 100644 index 00000000..94834eaa --- /dev/null +++ b/v11.6.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(); |