diff options
author | 2024-11-23 21:53:16 +0000 | |
---|---|---|
committer | 2024-11-23 21:53:16 +0000 | |
commit | a330b5071ba2d25747ec2b8223705319e18b482e (patch) | |
tree | be164bb8dd83ab13af8fc18776cd1207a08b7362 /v11.5.1/_static/changelog.js | |
parent | Deploying to docs from @ python-discord/bot-core@bdaaa2e76d4cb32843754757532e... (diff) |
Deploying to docs from @ python-discord/bot-core@cbe2bae7bd4826c804fd690cc695a7e4a6ba47d7 🚀
Diffstat (limited to 'v11.5.1/_static/changelog.js')
-rw-r--r-- | v11.5.1/_static/changelog.js | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/v11.5.1/_static/changelog.js b/v11.5.1/_static/changelog.js new file mode 100644 index 00000000..94834eaa --- /dev/null +++ b/v11.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(); |