first commit
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
/**
|
||||
* Fallback dark palette when Blocksy Colour Mode Switch is not active.
|
||||
* Matches Beatwise Customizer tokens from test2.beatwise.nl.
|
||||
*/
|
||||
|
||||
html.theme-dark {
|
||||
color-scheme: dark;
|
||||
|
||||
--blc-beatwise-purple: #442b79;
|
||||
--blc-beatwise-purple-hover: #5a3d9a;
|
||||
--blc-beatwise-purple-light: #9b8fd4;
|
||||
--blc-beatwise-purple-soft: #c4b5fd;
|
||||
|
||||
--theme-palette-color-1: var(--blc-beatwise-purple);
|
||||
--theme-palette-color-2: var(--blc-beatwise-purple-hover);
|
||||
--theme-palette-color-3: #333;
|
||||
--theme-palette-color-4: #f5f5f5;
|
||||
--theme-palette-color-5: #404040;
|
||||
--theme-palette-color-6: #1e1e1e;
|
||||
--theme-palette-color-7: #121212;
|
||||
--theme-palette-color-8: #ffffff;
|
||||
|
||||
--theme-text-color: var(--theme-palette-color-3);
|
||||
--theme-link-initial-color: var(--blc-beatwise-purple-light);
|
||||
--theme-link-hover-color: var(--blc-beatwise-purple-soft);
|
||||
--theme-headings-color: var(--theme-palette-color-4);
|
||||
--theme-border-color: var(--theme-palette-color-5);
|
||||
--theme-selection-text-color: #ffffff;
|
||||
--theme-selection-background-color: var(--blc-beatwise-purple);
|
||||
--theme-button-background-initial-color: var(--blc-beatwise-purple);
|
||||
--theme-button-background-hover-color: var(--blc-beatwise-purple-hover);
|
||||
}
|
||||
|
||||
html.theme-dark body,
|
||||
html.theme-dark #main-container,
|
||||
html.theme-dark .site {
|
||||
background-color: var(--theme-palette-color-7);
|
||||
color: var(--theme-text-color);
|
||||
}
|
||||
|
||||
html.theme-dark input:not([type="submit"]):not([type="button"]):not([type="reset"]),
|
||||
html.theme-dark textarea,
|
||||
html.theme-dark select {
|
||||
background-color: var(--theme-palette-color-6);
|
||||
color: var(--theme-palette-color-3);
|
||||
border-color: var(--theme-palette-color-5);
|
||||
}
|
||||
|
||||
html.blc-ldt-animate,
|
||||
html.blc-ldt-animate body {
|
||||
transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease;
|
||||
}
|
||||
|
||||
html.theme.dark .bwam-day-header {
|
||||
color: #000 !important;
|
||||
}
|
||||
@@ -0,0 +1,210 @@
|
||||
/**
|
||||
* Beatwise (test2.beatwise.nl) dark-mode fixes.
|
||||
* Tuned to Blocksy 2.1.38 global palette from the Customizer.
|
||||
*/
|
||||
|
||||
html.theme-dark {
|
||||
/* Beatwise brand — keep lavender purple, never blue */
|
||||
--blc-beatwise-purple: #442b79;
|
||||
--blc-beatwise-purple-hover: #5a3d9a;
|
||||
--blc-beatwise-purple-light: #9b8fd4;
|
||||
--blc-beatwise-purple-soft: #c4b5fd;
|
||||
|
||||
--theme-palette-color-1: var(--blc-beatwise-purple);
|
||||
--theme-palette-color-2: var(--blc-beatwise-purple-hover);
|
||||
--theme-palette-color-3: #e0e0e0;
|
||||
--theme-palette-color-4: #f5f5f5;
|
||||
--theme-palette-color-5: #404040;
|
||||
--theme-palette-color-6: #1e1e1e;
|
||||
--theme-palette-color-7: #121212;
|
||||
--theme-palette-color-8: #ffffff;
|
||||
|
||||
--theme-text-color: var(--theme-palette-color-3);
|
||||
--theme-headings-color: var(--theme-palette-color-4);
|
||||
--theme-link-initial-color: var(--blc-beatwise-purple-light);
|
||||
--theme-link-hover-color: var(--blc-beatwise-purple-soft);
|
||||
--theme-button-background-initial-color: var(--blc-beatwise-purple);
|
||||
--theme-button-background-hover-color: var(--blc-beatwise-purple-hover);
|
||||
--theme-selection-background-color: var(--blc-beatwise-purple);
|
||||
--theme-selection-text-color: #ffffff;
|
||||
}
|
||||
|
||||
html.theme-dark body {
|
||||
background-color: var(--theme-palette-color-7);
|
||||
color: var(--theme-text-color);
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------
|
||||
1 & 3 — Header menu + dropdown (Blocksy header type-1)
|
||||
------------------------------------------------------------------------- */
|
||||
html.theme-dark [data-header*="type-1"] .ct-header [data-id="menu"] > ul > li > a,
|
||||
html.theme-dark [data-header*="type-1"] .ct-header [data-id="menu"] .ct-menu-link {
|
||||
--theme-link-initial-color: #ffffff !important;
|
||||
color: #ffffff !important;
|
||||
}
|
||||
|
||||
html.theme-dark [data-header*="type-1"] .ct-header [data-id="menu"] > ul > li > a:hover,
|
||||
html.theme-dark [data-header*="type-1"] .ct-header [data-id="menu"] .ct-menu-link:hover {
|
||||
--theme-link-initial-color: var(--blc-beatwise-purple-soft) !important;
|
||||
color: var(--blc-beatwise-purple-soft) !important;
|
||||
}
|
||||
|
||||
html.theme-dark [data-header*="type-1"] .ct-header [data-id="menu"] .sub-menu {
|
||||
background-color: #2b2b2b !important;
|
||||
--dropdown-background-color: #2b2b2b !important;
|
||||
}
|
||||
|
||||
html.theme-dark [data-header*="type-1"] .ct-header [data-id="menu"] .sub-menu .ct-menu-link,
|
||||
html.theme-dark [data-header*="type-1"] .ct-header [data-id="menu"] .sub-menu a {
|
||||
--theme-link-initial-color: #ffffff !important;
|
||||
color: #ffffff !important;
|
||||
}
|
||||
|
||||
html.theme-dark [data-header*="type-1"] .ct-header [data-id="menu"] .sub-menu .ct-menu-link:hover,
|
||||
html.theme-dark [data-header*="type-1"] .ct-header [data-id="menu"] .sub-menu a:hover {
|
||||
color: var(--blc-beatwise-purple-soft) !important;
|
||||
background-color: rgba(255, 255, 255, 0.06) !important;
|
||||
}
|
||||
|
||||
html.theme-dark [data-header*="type-1"] [data-id="mobile-menu"] a,
|
||||
html.theme-dark [data-header*="type-1"] #offcanvas .ct-menu-link,
|
||||
html.theme-dark [data-header*="type-1"] #offcanvas a {
|
||||
--theme-link-initial-color: #ffffff !important;
|
||||
color: #ffffff !important;
|
||||
}
|
||||
|
||||
/* Account dropdown */
|
||||
html.theme-dark [data-header*="type-1"] [data-id="account"] .ct-header-account-dropdown {
|
||||
--theme-text-color: #ffffff !important;
|
||||
--dropdown-background-color: #2b2b2b !important;
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------
|
||||
5 — Footer: purple background + white text (same as light mode)
|
||||
------------------------------------------------------------------------- */
|
||||
html.theme-dark [data-footer*="type-1"] .ct-footer {
|
||||
background-color: var(--blc-beatwise-purple) !important;
|
||||
color: #ffffff !important;
|
||||
}
|
||||
|
||||
html.theme-dark [data-footer*="type-1"] .ct-footer,
|
||||
html.theme-dark [data-footer*="type-1"] .ct-footer p,
|
||||
html.theme-dark [data-footer*="type-1"] .ct-footer li,
|
||||
html.theme-dark [data-footer*="type-1"] .ct-footer span,
|
||||
html.theme-dark [data-footer*="type-1"] .ct-footer div,
|
||||
html.theme-dark [data-footer*="type-1"] .ct-footer h1,
|
||||
html.theme-dark [data-footer*="type-1"] .ct-footer h2,
|
||||
html.theme-dark [data-footer*="type-1"] .ct-footer h3,
|
||||
html.theme-dark [data-footer*="type-1"] .ct-footer h4,
|
||||
html.theme-dark [data-footer*="type-1"] .ct-footer h5,
|
||||
html.theme-dark [data-footer*="type-1"] .ct-footer h6,
|
||||
html.theme-dark [data-footer*="type-1"] .ct-footer .widget-title,
|
||||
html.theme-dark [data-footer*="type-1"] .ct-footer .ct-widget,
|
||||
html.theme-dark [data-footer*="type-1"] [data-id="copyright"] {
|
||||
--theme-text-color: #ffffff !important;
|
||||
--theme-heading-color: #ffffff !important;
|
||||
--theme-link-initial-color: #ffffff !important;
|
||||
--theme-link-hover-color: var(--blc-beatwise-purple-soft) !important;
|
||||
color: #ffffff !important;
|
||||
}
|
||||
|
||||
html.theme-dark [data-footer*="type-1"] .ct-footer a:hover,
|
||||
html.theme-dark [data-footer*="type-1"] [data-id="copyright"] a:hover {
|
||||
color: var(--blc-beatwise-purple-soft) !important;
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------
|
||||
6 — /codes page: dark text on light hero/header area
|
||||
------------------------------------------------------------------------- */
|
||||
html.theme-dark.page-codes [data-header*="type-1"] .ct-header [data-row*="middle"],
|
||||
html.theme-dark.blc-ldt-page-codes [data-header*="type-1"] .ct-header [data-row*="middle"] {
|
||||
background-color: rgba(255, 255, 255, 0.94) !important;
|
||||
}
|
||||
|
||||
html.theme-dark.page-codes [data-header*="type-1"] .ct-header [data-id="menu"] > ul > li > a,
|
||||
html.theme-dark.page-codes [data-header*="type-1"] .ct-header [data-id="menu"] .ct-menu-link,
|
||||
html.theme-dark.page-codes [data-header*="type-1"] .ct-header a,
|
||||
html.theme-dark.blc-ldt-page-codes [data-header*="type-1"] .ct-header [data-id="menu"] > ul > li > a,
|
||||
html.theme-dark.blc-ldt-page-codes [data-header*="type-1"] .ct-header [data-id="menu"] .ct-menu-link {
|
||||
--theme-link-initial-color: #181818 !important;
|
||||
color: #181818 !important;
|
||||
}
|
||||
|
||||
html.theme-dark.page-codes [data-header*="type-1"] .ct-header [data-id="menu"] > ul > li > a:hover,
|
||||
html.theme-dark.blc-ldt-page-codes [data-header*="type-1"] .ct-header [data-id="menu"] > ul > li > a:hover {
|
||||
color: var(--blc-beatwise-purple) !important;
|
||||
}
|
||||
|
||||
html.theme-dark.page-codes .hero-section,
|
||||
html.theme-dark.page-codes .entry-header,
|
||||
html.theme-dark.page-codes .wp-block-cover,
|
||||
html.theme-dark.blc-ldt-page-codes .hero-section,
|
||||
html.theme-dark.blc-ldt-page-codes .entry-header,
|
||||
html.theme-dark.blc-ldt-page-codes .wp-block-cover {
|
||||
color: #181818 !important;
|
||||
}
|
||||
|
||||
html.theme-dark.page-codes .hero-section h1,
|
||||
html.theme-dark.page-codes .hero-section p,
|
||||
html.theme-dark.page-codes .entry-header h1,
|
||||
html.theme-dark.page-codes .entry-header p,
|
||||
html.theme-dark.blc-ldt-page-codes .hero-section h1,
|
||||
html.theme-dark.blc-ldt-page-codes .hero-section p {
|
||||
color: #181818 !important;
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------
|
||||
2 — /reservations page: dark date labels on light schedule cards
|
||||
------------------------------------------------------------------------- */
|
||||
html.theme-dark.page-reservations .has-white-background-color,
|
||||
html.theme-dark.page-reservations .has-base-background-color,
|
||||
html.theme-dark.page-reservations .has-palette-color-8-background-color,
|
||||
html.theme-dark.page-reservations .has-palette-color-6-background-color,
|
||||
html.theme-dark.blc-ldt-page-reservations .has-white-background-color,
|
||||
html.theme-dark.blc-ldt-page-reservations .has-base-background-color,
|
||||
html.theme-dark.blc-ldt-page-reservations .has-palette-color-8-background-color,
|
||||
html.theme-dark.blc-ldt-page-reservations .has-palette-color-6-background-color {
|
||||
color: #181818 !important;
|
||||
}
|
||||
|
||||
html.theme-dark.page-reservations .has-white-background-color strong,
|
||||
html.theme-dark.page-reservations .has-white-background-color span,
|
||||
html.theme-dark.page-reservations .has-base-background-color strong,
|
||||
html.theme-dark.page-reservations .has-base-background-color span,
|
||||
html.theme-dark.blc-ldt-page-reservations .has-white-background-color strong,
|
||||
html.theme-dark.blc-ldt-page-reservations .has-white-background-color span,
|
||||
html.theme-dark.blc-ldt-page-reservations .has-base-background-color strong,
|
||||
html.theme-dark.blc-ldt-page-reservations .has-base-background-color span {
|
||||
color: #181818 !important;
|
||||
}
|
||||
|
||||
/* Reservation schedule grid (day headers like "Zondag 7 jun") */
|
||||
html.theme-dark.page-reservations article strong,
|
||||
html.theme-dark.page-reservations article .wp-block-group strong,
|
||||
html.theme-dark.blc-ldt-page-reservations article strong,
|
||||
html.theme-dark.blc-ldt-page-reservations article .wp-block-group strong {
|
||||
color: #181818 !important;
|
||||
}
|
||||
|
||||
html.theme-dark.page-reservations article .wp-block-group span,
|
||||
html.theme-dark.blc-ldt-page-reservations article .wp-block-group span {
|
||||
color: #181818 !important;
|
||||
}
|
||||
|
||||
/* Buttons stay Beatwise purple */
|
||||
html.theme-dark .wp-block-button__link,
|
||||
html.theme-dark .ct-button {
|
||||
background-color: var(--blc-beatwise-purple) !important;
|
||||
border-color: var(--blc-beatwise-purple) !important;
|
||||
color: #ffffff !important;
|
||||
}
|
||||
|
||||
html.theme-dark .wp-block-button__link:hover,
|
||||
html.theme-dark .ct-button:hover {
|
||||
background-color: var(--blc-beatwise-purple-hover) !important;
|
||||
border-color: var(--blc-beatwise-purple-hover) !important;
|
||||
}
|
||||
|
||||
html.theme.dark .bwam-day-header {
|
||||
color: #000 !important;
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
.blc-ldt-toggle {
|
||||
position: fixed;
|
||||
/* Position, offsets, and z-index are set via inline settings CSS. */
|
||||
right: 1.25rem;
|
||||
bottom: 1.25rem;
|
||||
z-index: 999999;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
padding: 0.5rem 0.65rem 0.5rem 0.5rem;
|
||||
border: 1px solid color-mix(in srgb, currentColor 18%, transparent);
|
||||
border-radius: 999px;
|
||||
background: var(--theme-palette-color-8, #ffffff);
|
||||
color: var(--theme-palette-color-1, #1a1a1a);
|
||||
box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
|
||||
font: 600 0.8125rem/1 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
|
||||
cursor: pointer;
|
||||
transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.2s ease, color 0.2s ease;
|
||||
}
|
||||
|
||||
.blc-ldt-toggle:hover {
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
|
||||
}
|
||||
|
||||
.blc-ldt-toggle:focus-visible {
|
||||
outline: 2px solid var(--theme-palette-color-1, #442b79);
|
||||
outline-offset: 3px;
|
||||
}
|
||||
|
||||
.blc-ldt-toggle__track {
|
||||
position: relative;
|
||||
width: 2.5rem;
|
||||
height: 1.375rem;
|
||||
border-radius: 999px;
|
||||
background: color-mix(in srgb, currentColor 12%, transparent);
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.blc-ldt-toggle__thumb {
|
||||
position: absolute;
|
||||
top: 2px;
|
||||
left: 2px;
|
||||
width: calc(1.375rem - 4px);
|
||||
height: calc(1.375rem - 4px);
|
||||
border-radius: 50%;
|
||||
background: var(--theme-palette-color-1, #442b79);
|
||||
transition: transform 0.25s ease;
|
||||
}
|
||||
|
||||
.blc-ldt-toggle--dark .blc-ldt-toggle__thumb {
|
||||
transform: translateX(1.125rem);
|
||||
}
|
||||
|
||||
.blc-ldt-toggle__icon {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 1rem;
|
||||
height: 1rem;
|
||||
}
|
||||
|
||||
html:not(.theme-dark) .blc-ldt-toggle__icon--moon,
|
||||
html.theme-dark .blc-ldt-toggle__icon--sun {
|
||||
display: none;
|
||||
}
|
||||
|
||||
html.theme-dark .blc-ldt-toggle {
|
||||
background: var(--theme-palette-color-7, #1a1a1a);
|
||||
color: var(--theme-palette-color-4, #f5f5f5);
|
||||
border-color: rgba(255, 255, 255, 0.12);
|
||||
}
|
||||
|
||||
/* Avoid overlap with Blocksy back-to-top button */
|
||||
.ct-back-to-top ~ .blc-ldt-toggle,
|
||||
#ct-back-to-top ~ .blc-ldt-toggle {
|
||||
bottom: 4.5rem;
|
||||
}
|
||||
|
||||
@media (max-width: 480px) {
|
||||
.blc-ldt-toggle {
|
||||
right: 1rem;
|
||||
bottom: 1rem;
|
||||
padding: 0.45rem;
|
||||
}
|
||||
|
||||
.blc-ldt-toggle__icon {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,169 @@
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
var config = window.blcLdt || {};
|
||||
var btn = document.getElementById('blc-ldt-toggle');
|
||||
if (!btn) return;
|
||||
|
||||
var storageKey = config.storageKey || 'blc_ldt_scheme';
|
||||
var cookieName = config.cookieName || 'blc_ldt_scheme';
|
||||
var blocksyKeys = config.blocksyStorageKeys || ['blocksyColorMode', 'blocksy_color_mode', 'theme'];
|
||||
var allKeys = [storageKey].concat(blocksyKeys);
|
||||
var respectOs = config.respectOsPreference !== false;
|
||||
var enableAnimation = config.enableAnimation !== false;
|
||||
var prefersDark = window.matchMedia('(prefers-color-scheme: dark)');
|
||||
|
||||
function getStoredScheme() {
|
||||
var i, stored;
|
||||
|
||||
try {
|
||||
for (i = 0; i < allKeys.length; i++) {
|
||||
stored = localStorage.getItem(allKeys[i]);
|
||||
if (stored === 'light' || stored === 'dark') {
|
||||
return stored;
|
||||
}
|
||||
}
|
||||
} catch (e) {}
|
||||
|
||||
var match = document.cookie.match(
|
||||
new RegExp('(?:^|; )' + cookieName.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') + '=([^;]*)')
|
||||
);
|
||||
if (match) {
|
||||
var cookieVal = decodeURIComponent(match[1]);
|
||||
if (cookieVal === 'light' || cookieVal === 'dark') {
|
||||
return cookieVal;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
function getScheme() {
|
||||
var stored = getStoredScheme();
|
||||
if (stored) {
|
||||
return stored;
|
||||
}
|
||||
return document.documentElement.classList.contains('theme-dark') ? 'dark' : 'light';
|
||||
}
|
||||
|
||||
function isDark() {
|
||||
return getScheme() === 'dark';
|
||||
}
|
||||
|
||||
function setCookie(scheme) {
|
||||
var path = config.cookiePath || '/';
|
||||
var domain = config.cookieDomain ? '; domain=' + config.cookieDomain : '';
|
||||
var maxAge = 60 * 60 * 24 * 365;
|
||||
document.cookie =
|
||||
cookieName +
|
||||
'=' +
|
||||
encodeURIComponent(scheme) +
|
||||
';path=' +
|
||||
path +
|
||||
domain +
|
||||
';max-age=' +
|
||||
maxAge +
|
||||
';SameSite=Lax';
|
||||
}
|
||||
|
||||
function persistScheme(scheme) {
|
||||
var i;
|
||||
|
||||
try {
|
||||
localStorage.setItem(storageKey, scheme);
|
||||
for (i = 0; i < blocksyKeys.length; i++) {
|
||||
localStorage.setItem(blocksyKeys[i], scheme);
|
||||
}
|
||||
} catch (e) {}
|
||||
|
||||
setCookie(scheme);
|
||||
}
|
||||
|
||||
function applyScheme(scheme, animate) {
|
||||
var root = document.documentElement;
|
||||
var isDarkMode = scheme === 'dark';
|
||||
var shouldAnimate = animate && enableAnimation;
|
||||
|
||||
if (shouldAnimate) {
|
||||
root.classList.add('blc-ldt-animate');
|
||||
window.setTimeout(function () {
|
||||
root.classList.remove('blc-ldt-animate');
|
||||
}, 300);
|
||||
}
|
||||
|
||||
root.classList.remove('theme-dark', 'theme-light');
|
||||
root.classList.add(isDarkMode ? 'theme-dark' : 'theme-light');
|
||||
root.setAttribute('data-blc-scheme', scheme);
|
||||
root.style.colorScheme = scheme;
|
||||
|
||||
persistScheme(scheme);
|
||||
updateButton(isDarkMode);
|
||||
|
||||
try {
|
||||
document.dispatchEvent(
|
||||
new CustomEvent('ct:color-mode:changed', {
|
||||
bubbles: true,
|
||||
detail: { mode: scheme },
|
||||
})
|
||||
);
|
||||
} catch (e) {}
|
||||
|
||||
if (config.isLoggedIn && config.ajaxUrl && config.nonce) {
|
||||
var body = new FormData();
|
||||
body.append('action', 'blc_ldt_save_scheme');
|
||||
body.append('nonce', config.nonce);
|
||||
body.append('scheme', scheme);
|
||||
fetch(config.ajaxUrl, { method: 'POST', body: body, credentials: 'same-origin' });
|
||||
}
|
||||
}
|
||||
|
||||
function updateButton(dark) {
|
||||
var i18n = config.i18n || {};
|
||||
btn.setAttribute('aria-pressed', dark ? 'true' : 'false');
|
||||
btn.setAttribute(
|
||||
'aria-label',
|
||||
dark ? i18n.light || 'Switch to light mode' : i18n.dark || 'Switch to dark mode'
|
||||
);
|
||||
btn.setAttribute(
|
||||
'title',
|
||||
dark ? i18n.lightLabel || 'Light mode' : i18n.darkLabel || 'Dark mode'
|
||||
);
|
||||
btn.classList.toggle('blc-ldt-toggle--dark', dark);
|
||||
}
|
||||
|
||||
function defaultScheme() {
|
||||
if (respectOs && prefersDark.matches) {
|
||||
return 'dark';
|
||||
}
|
||||
return 'light';
|
||||
}
|
||||
|
||||
btn.addEventListener('click', function () {
|
||||
applyScheme(isDark() ? 'light' : 'dark', true);
|
||||
});
|
||||
|
||||
document.addEventListener('ct:color-mode:changed', function (event) {
|
||||
if (!event.detail || !event.detail.mode) {
|
||||
return;
|
||||
}
|
||||
if (event.detail.mode !== 'light' && event.detail.mode !== 'dark') {
|
||||
return;
|
||||
}
|
||||
updateButton(event.detail.mode === 'dark');
|
||||
});
|
||||
|
||||
if (!getStoredScheme() && !document.documentElement.getAttribute('data-blc-scheme')) {
|
||||
applyScheme(defaultScheme(), false);
|
||||
} else {
|
||||
updateButton(document.documentElement.classList.contains('theme-dark'));
|
||||
}
|
||||
|
||||
if (respectOs) {
|
||||
prefersDark.addEventListener('change', function (event) {
|
||||
if (getStoredScheme()) {
|
||||
return;
|
||||
}
|
||||
applyScheme(event.matches ? 'dark' : 'light', true);
|
||||
});
|
||||
}
|
||||
})();
|
||||
Reference in New Issue
Block a user