function replaceColorInSvgUrl(el, type = '') { console.log('replaceColorInSvgUrl'); console.log(el); if ( ! jQuery(el).length ) { return; } let appliedColor = '--wp--preset--color--base'; if ( 'dark' === type ) { appliedColor = '--wp--preset--color--contrast'; } console.log(appliedColor); const colorValue = getComputedStyle(document.documentElement).getPropertyValue(appliedColor).trim().replace('#', '%23'); console.log(colorValue); const svgUrl = jQuery(el).css('background'); const regex = /%23insertcolorhere/g; const newBg = svgUrl.replace(regex, colorValue); jQuery(el).css({'background': newBg, 'opacity': 1}); } export function navSetup() { console.log('navSetup'); var viewportWidth = jQuery(window).outerWidth(true); jQuery('.business-blitz-header-one-light-nav').removeAttr('style'); let container; let nav; if ( jQuery('.is-style-business-blitz-header-one-light').length ) { console.log('found header light'); container = '.is-style-business-blitz-header-one-light'; nav = '.business-blitz-header-one-light-meta'; } if ( jQuery('.is-style-business-blitz-header-one-dark').length ) { console.log('found header dark'); container = '.is-style-business-blitz-header-one-dark'; nav = '.business-blitz-header-one-dark-meta'; } if (viewportWidth > 780) { var navHeight = jQuery(nav).outerHeight(true); jQuery(container).css({'padding-top':navHeight,'opacity':1}); jQuery(nav).removeAttr('style'); jQuery(nav).css({'position':'absolute', 'top':0, 'left':0, 'width':'100%', 'padding-right':'var(--wp--style--root--padding-right)', 'padding-left':'var(--wp--style--root--padding-left)'}); } else { jQuery(nav).removeAttr('style'); jQuery(container).removeAttr('style'); replaceColorInSvgUrl('.business-blitz-header-one-light-icon', 'dark'); replaceColorInSvgUrl('.business-blitz-header-one-dark-icon', 'light'); } }