БРЕНДИ
+38 (096) 798-82-89
Наша адреса
УКРАЇНА
Телефони
Графік роботи
  • Пн-Пт: з 9 до 18
  • Сб: з 10 до 17
  • Нд: з 11 до 16
E-mail
Перейти до контактів
0 0
Каталог
Головна
Закладки
0
Порівняти
0
Контакти

Пітчери

В категорії немає товарів

Продовжити
(function () { 'use strict'; const root = document.documentElement; const darkClass = 'sklp-dark'; function parseRgb(value) { if (!value || value === 'transparent') return null; const match = value.match( /rgba?\(\s*([0-9.]+)[,\s]+([0-9.]+)[,\s]+([0-9.]+)(?:\s*[,/]\s*([0-9.]+))?\s*\)/i ); if (!match) return null; const alpha = match[4] === undefined ? 1 : Number(match[4]); if (alpha === 0) return null; return [ Number(match[1]), Number(match[2]), Number(match[3]) ]; } function relativeLuminance(rgb) { const srgb = rgb.map(function (value) { const c = value / 255; return c <= 0.04045 ? c / 12.92 : Math.pow((c + 0.055) / 1.055, 2.4); }); return ( 0.2126 * srgb[0] + 0.7152 * srgb[1] + 0.0722 * srgb[2] ); } function detectDarkTheme() { const candidates = [ document.querySelector('main'), document.querySelector('#content'), document.body, root ].filter(Boolean); const backgroundLuminances = candidates .map(function (element) { return parseRgb( getComputedStyle(element).backgroundColor ); }) .filter(Boolean) .map(relativeLuminance); if (backgroundLuminances.length) { return Math.min.apply( null, backgroundLuminances ) < 0.35; } if (document.body) { const textRgb = parseRgb( getComputedStyle(document.body).color ); if (textRgb) { return relativeLuminance(textRgb) > 0.55; } } return window.matchMedia( '(prefers-color-scheme: dark)' ).matches; } function syncDarkClass() { root.classList.toggle( darkClass, detectDarkTheme() ); } let frameId = 0; function scheduleSync() { if (frameId) { window.cancelAnimationFrame(frameId); } frameId = window.requestAnimationFrame(function () { frameId = 0; syncDarkClass(); }); } if (document.readyState === 'loading') { document.addEventListener( 'DOMContentLoaded', scheduleSync, { once: true } ); } else { scheduleSync(); } const observer = new MutationObserver(scheduleSync); observer.observe(root, { attributes: true, attributeFilter: [ 'class', 'style', 'data-theme' ] }); if (document.body) { observer.observe(document.body, { attributes: true, attributeFilter: [ 'class', 'style', 'data-theme' ] }); } const media = window.matchMedia( '(prefers-color-scheme: dark)' ); if (typeof media.addEventListener === 'function') { media.addEventListener( 'change', scheduleSync ); } else if (typeof media.addListener === 'function') { media.addListener(scheduleSync); } document.addEventListener( 'click', function () { window.setTimeout( scheduleSync, 80 ); }, true ); })();