diff options
author | 2023-06-10 18:58:54 +0000 | |
---|---|---|
committer | 2023-06-10 18:58:54 +0000 | |
commit | e5a6dabe4e551182ed29fbe36cefbb8115b08f4d (patch) | |
tree | f604d37c45b88c76b3f6e1a1fb0a1ef9bde24215 /v9.7.0/_static/changelog.js | |
parent | Deploying to docs from @ python-discord/bot-core@c57fae8198cadcab3f9c0b09d118... (diff) |
Deploying to docs from @ python-discord/bot-core@8d14eb4513cc9348168800995eaac1a054e3e780 🚀
Diffstat (limited to 'v9.7.0/_static/changelog.js')
-rw-r--r-- | v9.7.0/_static/changelog.js | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/v9.7.0/_static/changelog.js b/v9.7.0/_static/changelog.js new file mode 100644 index 00000000..94834eaa --- /dev/null +++ b/v9.7.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(); |