Skip to content

Commit

Permalink
feat: add dark theme support for static html files (#373)
Browse files Browse the repository at this point in the history
* Add dark theme styling

* Add auto detect preferred  color scheme
  • Loading branch information
rowenslee authored Oct 21, 2024
1 parent b6133a1 commit 3d1e573
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 0 deletions.
25 changes: 25 additions & 0 deletions resources/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -175,4 +175,29 @@
right: 8px;
top: 38px;
}
}

/* Dark Theme Styles */
@media (prefers-color-scheme: dark) {
body.dark-theme {
background-color: #2a2a2a; /* Softer gray background */
color: #e0e0e0;
}
body.dark-theme h1 {
color: #e0e0e0;
}
body.dark-theme p {
color: #b0b0b0;
}
body.dark-theme .btn-primary {
background-color: #3a3a3a;
border-color: #545454;
}
body.dark-theme .btn-primary:hover {
background-color: #545454;
}
body.dark-theme .card {
background-color: #3a3a3a;
border-color: #545454;
}
}
5 changes: 5 additions & 0 deletions resources/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,11 @@ <h5 class="modal-title">Terms of Service</h5>
if (processor === 'zebedee') {
document.getElementById('powered-by-zebedee').classList.remove('d-none')
}

// Check for system preference on load
if (window.matchMedia('(prefers-color-scheme: dark)').matches) {
document.body.classList.add('dark-theme');
}
}
</script>
</body>
Expand Down
5 changes: 5 additions & 0 deletions resources/invoices.html
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@ <h2 class="text-danger">Invoice expired!</h2>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.min.js" integrity="sha384-cuYeSxntonz0PPNlHhBs68uyIAVpIIOZZ5JqeqvYYIcEL727kskC66kF92t6Xl2V" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/qrcodejs/1.0.0/qrcode.min.js" integrity="sha512-CNgIRecGo7nphbeZ04Sc13ka07paqdeTu0WR1IM4kNcpmBAUSHSQX0FslNhTDadL4O5SAGapGt4FodqL8My0mA==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script>
// Check for system preference on load
if (window.matchMedia('(prefers-color-scheme: dark)').matches) {
document.body.classList.add('dark-theme');
}

var reference = "{{reference}}"
var relayUrl = "{{relay_url}}"
var relayPubkey = "{{relay_pubkey}}"
Expand Down
6 changes: 6 additions & 0 deletions resources/terms.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,11 @@ <h3>Terms of Service Agreement</h3>
</div>
</main>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.min.js" integrity="sha384-cuYeSxntonz0PPNlHhBs68uyIAVpIIOZZ5JqeqvYYIcEL727kskC66kF92t6Xl2V" crossorigin="anonymous"></script>
<script>
// Check for system preference on load
if (window.matchMedia('(prefers-color-scheme: dark)').matches) {
document.body.classList.add('dark-theme');
}
</script>
</body>
</html>

0 comments on commit 3d1e573

Please sign in to comment.