diff options
author | 2022-07-23 14:35:07 +0000 | |
---|---|---|
committer | 2022-07-23 14:35:07 +0000 | |
commit | 02ed8edf235883eaaf0958d3548f34d198722c05 (patch) | |
tree | 5620beb3b2a91a6e36e73a9f3ef6c3014bfa1bd7 /v7.5.0/_static/changelog.js | |
parent | Deploying to docs from @ python-discord/bot-core@c584af6f4791530f16aa32f30926... (diff) |
Deploying to docs from @ python-discord/bot-core@cfdc1b7c3dedae53f15ce696aee0c7141ba8c606 🚀
Diffstat (limited to 'v7.5.0/_static/changelog.js')
-rw-r--r-- | v7.5.0/_static/changelog.js | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/v7.5.0/_static/changelog.js b/v7.5.0/_static/changelog.js new file mode 100644 index 00000000..94834eaa --- /dev/null +++ b/v7.5.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(); |