diff options
author | 2024-01-30 21:52:45 +0000 | |
---|---|---|
committer | 2024-01-30 21:52:45 +0000 | |
commit | 84a7124e62f211a51acb1e698628a98ce8141671 (patch) | |
tree | bb8bea7c74d873a021565491b663cd58fa0622d2 /v10.7.0/_static/changelog.js | |
parent | Deploying to docs from @ python-discord/bot-core@c7b614025e9c3faf3b16bb019f28... (diff) |
Deploying to docs from @ python-discord/bot-core@07f517225fc59157233f74edb136ee39046fda00 🚀
Diffstat (limited to 'v10.7.0/_static/changelog.js')
-rw-r--r-- | v10.7.0/_static/changelog.js | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/v10.7.0/_static/changelog.js b/v10.7.0/_static/changelog.js new file mode 100644 index 00000000..94834eaa --- /dev/null +++ b/v10.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(); |