{
const sections = document.querySelectorAll('main > section')
if (!sections.length) return;
const scrollY = window.pageYOffset + $refs.headerRef.clientHeight;
sections.forEach((section) => {
const sectionTop = section.offsetTop;
const sectionBottom = section.clientHeight + section.offsetTop;
if (sectionTop <= scrollY && sectionBottom >= scrollY) {
if (section.classList.contains('bg-light')) {
isDarkHeader = true;
} else {
const sectionRGB = window.getComputedStyle(section, null).getPropertyValue('background-color');
const [r, g, b] = sectionRGB.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/) || []
const ir = Math.floor((255-r)*1);
const ig = Math.floor((255-g)*1);
const ib = Math.floor((255-b)*1);
isDarkHeader = !isNaN(ir) || !isNaN(ig) || !isNaN(ib);
}
}
})
}"
class="header w-100 position-fixed top-0 start-0">