Fix light mode flash on chat page
Add inline script at top of base.html <head> to set theme immediately before any rendering occurs. Prevents white flash when loading chat and other pages that extend base.html in dark mode.
This commit is contained in:
parent
2a85bbe53e
commit
a3d1e18a37
1 changed files with 7 additions and 0 deletions
|
|
@ -4,6 +4,13 @@
|
|||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>{% block title %}Chatroom{% endblock %}</title>
|
||||
<script>
|
||||
// Set theme immediately to prevent flash
|
||||
(function() {
|
||||
const savedTheme = localStorage.getItem('theme') || 'light';
|
||||
document.documentElement.setAttribute('data-theme', savedTheme);
|
||||
})();
|
||||
</script>
|
||||
|
||||
<!-- Include highlight.js library for syntax highlighting -->
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.6.0/highlight.min.js"></script>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue