fixed dark/light mode
This commit is contained in:
@@ -9,30 +9,6 @@
|
||||
|
||||
<title>{{ $title ?? config('app.name', 'BestTech') }}</title>
|
||||
|
||||
<!-- Dark Mode Script (Must be in head to prevent flash) -->
|
||||
<script>
|
||||
// Check for saved theme preference or default to light mode
|
||||
if (localStorage.theme === 'dark' || (!('theme' in localStorage) && window.matchMedia('(prefers-color-scheme: dark)').matches)) {
|
||||
document.documentElement.classList.add('dark');
|
||||
} else {
|
||||
document.documentElement.classList.remove('dark');
|
||||
}
|
||||
|
||||
// Toggle theme function
|
||||
window.toggleTheme = function() {
|
||||
const html = document.documentElement;
|
||||
const isDark = html.classList.contains('dark');
|
||||
|
||||
if (isDark) {
|
||||
html.classList.remove('dark');
|
||||
localStorage.setItem('theme', 'light');
|
||||
} else {
|
||||
html.classList.add('dark');
|
||||
localStorage.setItem('theme', 'dark');
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<!-- Fonts -->
|
||||
<link rel="preconnect" href="https://fonts.bunny.net">
|
||||
<link href="https://fonts.bunny.net/css?family=inter:300,400,500,600,700,800" rel="stylesheet">
|
||||
|
||||
Reference in New Issue
Block a user