From 2f6e368928a00c55b9483657d141c49d2bd523b1 Mon Sep 17 00:00:00 2001 From: ChrisLovering Date: Tue, 25 Jul 2023 13:34:53 +0000 Subject: Deploying to docs from @ python-discord/bot-core@fc8af5edac4aaacb9862401d7a804cc643568e81 🚀 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- v10.0.0/_static/changelog.js | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 v10.0.0/_static/changelog.js (limited to 'v10.0.0/_static/changelog.js') diff --git a/v10.0.0/_static/changelog.js b/v10.0.0/_static/changelog.js new file mode 100644 index 00000000..94834eaa --- /dev/null +++ b/v10.0.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(); -- cgit v1.2.3