function layers_apply_customizer_styles() { /** * Setup the colors to use below */ $main_color = layers_get_theme_mod('site-accent-color', TRUE); $header_color = layers_get_theme_mod('header-background-color', FALSE); $header_color_no_default = layers_get_theme_mod('header-background-color', TRUE); $footer_color = layers_get_theme_mod('footer-background-color', FALSE); /** * Header Colors */ // Opacity //$bg_opacity = ( layers_get_theme_mod( 'header-overlay') ) ? .5 : 1 ; $bg_opacity = 1; // Apply the BG Color if ('' != $header_color) { layers_inline_styles('.header-site, .header-site.header-sticky', 'css', array('css' => 'background-color: rgba(' . implode(', ', layers_hex2rgb($header_color)) . ', ' . $bg_opacity . '); ')); // Add Invert if the color is not light if ('dark' == layers_is_light_or_dark($header_color)) { add_filter('layers_header_class', 'layers_add_invert_class'); } } /** * Footer Colors */ if ('' != $footer_color) { // Apply the BG Color layers_inline_styles('.footer-site', 'background', array('background' => array('color' => $footer_color))); // Add Invert if the color is dark if ('dark' == layers_is_light_or_dark($footer_color)) { add_filter('layers_footer_site_class', 'layers_add_invert_class'); } } /** * General Colors */ if ('' != $header_color) { // Title Container layers_inline_styles('.title-container', 'background', array('background' => array('color' => $header_color))); if ('dark' == layers_is_light_or_dark($header_color)) { add_filter('layers_title_container_class', 'layers_add_invert_class'); } } if ('' != $main_color) { // Buttons layers_inline_button_styles('', 'button', array('selectors' => array('input[type="button"]', 'input[type="submit"]', 'button', '.button', '.form-submit input[type="submit"]', '.invert input[type="button"]', '.invert input[type="submit"]', '.invert button', '.invert .button', '.invert .form-submit input[type="submit"]'), 'button' => array('background-color' => $main_color))); // Content - Links layers_inline_styles(array('selectors' => array('.copy a:not(.button)', '.story a:not(.button)'), 'css' => array('color' => $main_color, 'border-bottom-color' => $main_color))); layers_inline_styles(array('selectors' => array('.copy a:not(.button):hover', '.story a:not(.button):hover'), 'css' => array('color' => layers_too_light_then_dark($main_color), 'border-bottom-color' => layers_too_light_then_dark($main_color)))); } }
function layers_apply_customizer_styles() { /** * Setup the colors to use below */ $main_color = layers_get_theme_mod('site-accent-color', TRUE); $header_color = layers_get_theme_mod('header-background-color', FALSE); $header_color_no_default = layers_get_theme_mod('header-background-color', TRUE); $footer_color = layers_get_theme_mod('footer-background-color', FALSE); /** * Header Colors */ $bg_opacity = 1; // Apply the BG Color if ('' != $header_color) { layers_inline_styles('.header-site, .header-site.header-sticky', 'css', array('css' => 'background-color: rgba(' . implode(', ', layers_hex2rgb($header_color)) . ', ' . $bg_opacity . '); ')); // Add Invert if the color is not light if ('dark' == layers_is_light_or_dark($header_color)) { add_filter('layers_header_class', 'layers_add_invert_class'); } } /** * General Colors */ if ('' != $header_color) { // Title Container layers_inline_styles('.title-container', 'background', array('background' => array('color' => $header_color))); if ('dark' == layers_is_light_or_dark($header_color)) { add_filter('layers_title_container_class', 'layers_add_invert_class'); } } if ('' != $main_color) { // Buttons layers_inline_button_styles('', 'button', array('selectors' => array('input[type="button"]', 'input[type="submit"]', 'button', '.button', '.form-submit input[type="submit"]', '.invert input[type="button"]', '.invert input[type="submit"]', '.invert button', '.invert .button', '.invert .form-submit input[type="submit"]'), 'button' => array('background-color' => $main_color))); // Content - Links layers_inline_styles(array('selectors' => array('.copy a:not(.button)', '.story a:not(.button)'), 'css' => array('color' => $main_color, 'border-bottom-color' => $main_color))); layers_inline_styles(array('selectors' => array('.copy a:not(.button):hover', '.story a:not(.button):hover'), 'css' => array('color' => layers_too_light_then_dark($main_color), 'border-bottom-color' => layers_too_light_then_dark($main_color)))); // Debugging: global $wp_customize; if ($wp_customize && (bool) layers_get_theme_mod('dev-switch-button-css-testing')) { echo '<pre style="font-size:11px;">'; echo 'RE: Buttons - This should not happen if Layers Pro is active!'; echo '</pre>'; } } /** * Footer Colors. */ if ('' != $footer_color) { // Apply the BG Color layers_inline_styles('.footer-site', 'background', array('background' => array('color' => $footer_color))); // Add Invert if the color is dark if ('dark' == layers_is_light_or_dark($footer_color)) { add_filter('layers_footer_site_class', 'layers_add_invert_class'); } } }