|
1 | 1 |
|
2 | | -<div class="header-icons"> |
3 | | - <a href="https://github.com/Parley-Chat/Parley-Chat" target="_blank" class="header-icon"> |
4 | | - <svg class="github-icon" viewBox="0 0 24 24" width="24" height="24"> |
5 | | - <path d="M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0024 12c0-6.63-5.37-12-12-12z"/> |
6 | | - </svg> |
7 | | - </a> |
8 | | - <button class="theme-toggle header-icon" onclick="toggleTheme()"> |
9 | | - <svg class="theme-icon sun-icon" viewBox="0 0 24 24" width="24" height="24" style="display: none;"> |
10 | | - <path d="M12 7c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5zM2 13h2c.55 0 1-.45 1-1s-.45-1-1-1H2c-.55 0-1 .45-1 1s.45 1 1 1zm18 0h2c.55 0 1-.45 1-1s-.45-1-1-1h-2c-.55 0-1 .45-1 1s.45 1 1 1zM11 2v2c0 .55.45 1 1 1s1-.45 1-1V2c0-.55-.45-1-1-1s-1 .45-1 1zm0 18v2c0 .55.45 1 1 1s1-.45 1-1v-2c0-.55-.45-1-1-1s-1 .45-1 1zM5.99 4.58c-.39-.39-1.03-.39-1.41 0-.39.39-.39 1.03 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0s.39-1.03 0-1.41L5.99 4.58zm12.37 12.37c-.39-.39-1.03-.39-1.41 0-.39.39-.39 1.03 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0 .39-.39.39-1.03 0-1.41l-1.06-1.06zm1.06-10.96c.39-.39.39-1.03 0-1.41-.39-.39-1.03-.39-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0l1.06-1.06zM7.05 18.36c.39-.39.39-1.03 0-1.41-.39-.39-1.03-.39-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0l1.06-1.06z"/> |
11 | | - </svg> |
12 | | - <svg class="theme-icon moon-icon" viewBox="0 0 24 24" width="24" height="24"> |
13 | | - <path d="M12.34 2.02C6.59 1.82 2 6.42 2 12c0 5.52 4.48 10 10 10 3.71 0 6.93-2.02 8.66-5.02-7.51-.25-13.54-6.15-8.32-14.96z"/> |
14 | | - </svg> |
15 | | - </button> |
16 | | -</div> |
17 | | - |
18 | 2 | <script> |
19 | 3 | function toggleTheme() { |
20 | 4 | const body = document.body; |
21 | 5 | const currentTheme = body.classList.contains('light') ? 'light' : 'dark'; |
22 | 6 | const newTheme = currentTheme === 'dark' ? 'light' : 'dark'; |
23 | 7 |
|
24 | | - // Remove existing theme classes |
25 | 8 | body.classList.remove('light', 'dark'); |
26 | | - |
27 | | - // Apply new theme |
28 | 9 | body.classList.add(newTheme); |
29 | 10 | body.setAttribute('data-color-mode', newTheme); |
30 | 11 | document.documentElement.setAttribute('data-color-mode', newTheme); |
|
43 | 24 | } |
44 | 25 | } |
45 | 26 |
|
46 | | -// Initialize theme on page load |
47 | 27 | document.addEventListener('DOMContentLoaded', function() { |
48 | 28 | const savedTheme = localStorage.getItem('theme') || 'dark'; |
49 | 29 | const body = document.body; |
50 | 30 |
|
51 | | - // Apply saved theme |
52 | 31 | body.classList.remove('light', 'dark'); |
53 | 32 | body.classList.add(savedTheme); |
54 | 33 | body.setAttribute('data-color-mode', savedTheme); |
|
0 commit comments