Skip to content

Commit

Permalink
[chores] Improvements to Dark theme added by @colthreepv
Browse files Browse the repository at this point in the history
- Pygments Themes: The Pygments color formatting for code
  samples was not displaying well on the dark theme.
- Color Adjustment: I made the orange tone in the dark
  version slightly darker.
- Dark/Light Mode Switch: I have reinstated the dark/light
  mode switch in the upper right corner.
  • Loading branch information
nemesifier committed Sep 25, 2024
1 parent 755cdcb commit 17e2a5b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 47 deletions.
15 changes: 9 additions & 6 deletions _static/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@
html.dark {
--text-color: #e0e0e0;
--background-color: #1a1a1a;
--link-color: #ff9d5c;
--link-hover-color: #ffb380;
--link-color: #ee7f31;
--link-hover-color: #ff9d5c;
--admonition-bg: #2c2c2c;
--admonition-color: #b0d4ff;
--code-bg: #2c2c2c;
--sidebar-bg: rgba(60, 60, 60, 0.5);
--current-link-color: #ff9d5c;
--current-link-color: #ee7f31;
--header-link-color: #b0b0b0;
}

Expand Down Expand Up @@ -108,6 +108,9 @@ table thead th { font-weight: 600 }
font-style: normal;
color: var(--link-hover-color);
}
html.dark #content h1 em {
color: var(--link-color);
}
#content h2 {
margin-top: 2rem;
font-size: 1.6em;
Expand Down Expand Up @@ -177,12 +180,12 @@ code.download {

a.rounded-md,
a.rounded-md:hover {
background-color: var(--link-hover-color);
background-color: var(--link-color);
color: var(--background-color);
font-weight: 600;
}
a.rounded-md:hover {
background-color: var(--link-color);
background-color: var(--link-hover-color);
}

a.rounded-md svg.mr-2 {
Expand Down Expand Up @@ -413,4 +416,4 @@ main > div .flex.justify-between.items-center.pt-6 {

#doc-versions .download-links a:hover {
text-decoration: underline;
}
}
3 changes: 0 additions & 3 deletions _templates/header.html

This file was deleted.

37 changes: 0 additions & 37 deletions _templates/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,24 +29,6 @@
ePUB</a>
</p>
</li>
<li class="color-mode">
<p>
{{ _('Color') }}:
<a href="#"
id="light-mode"
@click.prevent="darkMode = 'light'; localStorage.setItem('darkMode', 'light')"
:class="{ 'font-bold': darkMode === 'light' }">
{{ _('Light') }}
</a>
/
<a href="#"
id="dark-mode"
@click.prevent="darkMode = 'dark'; localStorage.setItem('darkMode', 'dark')"
:class="{ 'font-bold': darkMode === 'dark' }">
{{ _('Dark') }}
</a>
</p>
</li>
</ul>
{% endblock %}

Expand All @@ -73,25 +55,6 @@
</noscript>
<!-- End Matomo Code -->

<!-- Color Mode -->
<script>
document.addEventListener('DOMContentLoaded', function() {
const lightModeButton = document.getElementById('light-mode');
const darkModeButton = document.getElementById('dark-mode');

lightModeButton.addEventListener('click', function(e) {
e.preventDefault();
localStorage.setItem('darkMode', 'light');
});

darkModeButton.addEventListener('click', function(e) {
e.preventDefault();
localStorage.setItem('darkMode', 'dark');
});
});
</script>
<!-- End Color Mode -->

<div id="lightbox" class="lightbox">
<span class="close">&times;</span>
</div>
Expand Down
3 changes: 2 additions & 1 deletion conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@
# show_authors = False

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
pygments_style = 'trac'
pygments_style_dark = 'lightbulb'

# A list of ignored prefixes for module index sorting.
# modindex_common_prefix = []
Expand Down

0 comments on commit 17e2a5b

Please sign in to comment.