From 1370b89fb924ae889bc128de8b93578cc0101239 Mon Sep 17 00:00:00 2001 From: Hassan Abouelela Date: Thu, 2 Dec 2021 14:46:48 +0400 Subject: Add Sphinx Docs Adds a customized sphinx doc builder. --- docs/_static/changelog.js | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 docs/_static/changelog.js (limited to 'docs/_static/changelog.js') diff --git a/docs/_static/changelog.js b/docs/_static/changelog.js new file mode 100644 index 00000000..f72d025c --- /dev/null +++ b/docs/_static/changelog.js @@ -0,0 +1,37 @@ +/** Update the changelog colors in dark mode */ + +const changelog = document.getElementById("changelog"); + +function updateEntryColor(entry) { + const line = entry.lastChild; + const lightColorSpan = line.childNodes.item(1); + const darkColorSpan = lightColorSpan.cloneNode(true); + + line.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 = null; + } + + darkColorSpan.style["color"] = color; +} + +if (changelog !== null) { + for (let collection of changelog.getElementsByClassName("simple")) { + Array.from(collection.children).forEach(updateEntryColor); + } +} -- cgit v1.2.3