diff options
author | 2023-02-09 22:17:34 +0000 | |
---|---|---|
committer | 2023-02-09 22:17:34 +0000 | |
commit | 4297b503b31c84273400bd8a9431722f55ed9abe (patch) | |
tree | 4773b6daabaa0b8ff42d4e135b9447e0bf7dea32 /v9.4.0/_static/changelog.js | |
parent | Deploying to docs from @ python-discord/bot-core@08a7a742f61d655c2bd4fd02b95b... (diff) |
Deploying to docs from @ python-discord/bot-core@69e52d3b68787789b8dc8a21d7ed5a2d8e527e12 🚀
Diffstat (limited to 'v9.4.0/_static/changelog.js')
-rw-r--r-- | v9.4.0/_static/changelog.js | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/v9.4.0/_static/changelog.js b/v9.4.0/_static/changelog.js new file mode 100644 index 00000000..94834eaa --- /dev/null +++ b/v9.4.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(); |