Merge pull request #1 from raven2cz/raven2cz/ldoc_themes

Add ldoc new themes.
This commit is contained in:
Tonda Fischer 2022-10-07 09:12:05 +02:00 committed by GitHub
commit 2652cc3ebd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 735 additions and 146 deletions

File diff suppressed because it is too large Load Diff

View File

@ -125,6 +125,16 @@
<div id="navigation"> <div id="navigation">
<h1>$(ldoc.project)</h1> <h1>$(ldoc.project)</h1>
<div class="select">
<select name="theme" id="theme-select">
<option selected disabled>Choose a theme</option>
<option value="light">LDoc Light</option>
<option value="dark">Awesome Dark</option>
<option value="monokai">Monokai</option>
<option value="onedark">One Dark</option>
</select>
</div>
# if not ldoc.single and module then -- reference back to project index # if not ldoc.single and module then -- reference back to project index
<ul> <ul>
<li><a href="../$(ldoc.output).html">Index</a></li> <li><a href="../$(ldoc.output).html">Index</a></li>
@ -625,6 +635,21 @@
</div> <!-- id="container" --> </div> <!-- id="container" -->
<script defer type="text/javascript"> <script defer type="text/javascript">
// Theme selection and its local storage
var select = document.getElementById("theme-select");
var storedTheme = localStorage.getItem('theme') || (window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light");
if (storedTheme) {
select.value = storedTheme;
document.documentElement.setAttribute('data-theme', storedTheme)
}
select.addEventListener("change", function() {
var targetTheme = this.value;
document.documentElement.setAttribute('data-theme', targetTheme)
localStorage.setItem('theme', targetTheme);
});
const $nav = document.querySelector("#navigation"); const $nav = document.querySelector("#navigation");
// When clicking the sidebar, open it // When clicking the sidebar, open it