diff options
author | 2022-05-11 02:42:43 +0400 | |
---|---|---|
committer | 2022-05-29 16:19:52 +0400 | |
commit | ed4b2fbea5c664a1950df66a534b3233efdc5c4e (patch) | |
tree | 4db5dd241e0add8a572a50a239a75be2a305078b /docs/_static | |
parent | Remove Discord `MissingSentinel` (diff) |
Restore Releases Changelog
Add the releases-based changelog system back, and migrate the old
changelog entries.
Signed-off-by: Hassan Abouelela <[email protected]>
Diffstat (limited to 'docs/_static')
-rw-r--r-- | docs/_static/changelog.css | 11 | ||||
-rw-r--r-- | docs/_static/changelog.js | 41 |
2 files changed, 52 insertions, 0 deletions
diff --git a/docs/_static/changelog.css b/docs/_static/changelog.css new file mode 100644 index 00000000..343792a1 --- /dev/null +++ b/docs/_static/changelog.css @@ -0,0 +1,11 @@ +[data-theme='dark'] #changelog .dark, +[data-theme='light'] #changelog .light, +[data-theme='auto'] #changelog .light { + display: inline; +} + +[data-theme='dark'] #changelog .light, +[data-theme='light'] #changelog .dark, +[data-theme='auto'] #changelog .dark { + display: none; +} diff --git a/docs/_static/changelog.js b/docs/_static/changelog.js new file mode 100644 index 00000000..94834eaa --- /dev/null +++ b/docs/_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(); |