feat: add dark mode and switch button
This commit is contained in:
@@ -157,6 +157,19 @@ if (empty($videoData) || isset($videoData['error'])) {
|
||||
outputJsonLd($breadcrumbJsonLd);
|
||||
?>
|
||||
<?php endif; ?>
|
||||
|
||||
<!-- Script pour éviter le flash en mode sombre -->
|
||||
<script>
|
||||
(function() {
|
||||
const savedTheme = localStorage.getItem('theme');
|
||||
const systemPrefersDark = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches;
|
||||
const shouldUseDark = savedTheme === 'dark' || (!savedTheme && systemPrefersDark);
|
||||
|
||||
if (shouldUseDark) {
|
||||
document.documentElement.setAttribute('data-theme', 'dark');
|
||||
}
|
||||
})();
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<?php include 'includes/sidebar.php'; ?>
|
||||
|
||||
Reference in New Issue
Block a user