/** * Add CSS in <head> for styles handled by the theme customizer * * @since 1.0.0 */ public function add_customizer_css() { $background_color = storefront_get_content_background_color(); $accent_color = get_theme_mod('storefront_accent_color'); $header_background_color = get_theme_mod('storefront_header_background_color'); $header_link_color = get_theme_mod('storefront_header_link_color'); $header_text_color = get_theme_mod('storefront_header_text_color'); $footer_background_color = get_theme_mod('storefront_footer_background_color'); $footer_link_color = get_theme_mod('storefront_footer_link_color'); $footer_heading_color = get_theme_mod('storefront_footer_heading_color'); $footer_text_color = get_theme_mod('storefront_footer_text_color'); $text_color = get_theme_mod('storefront_text_color'); $heading_color = get_theme_mod('storefront_heading_color'); $button_background_color = get_theme_mod('storefront_button_background_color'); $button_text_color = get_theme_mod('storefront_button_text_color'); $button_alt_background_color = get_theme_mod('storefront_button_alt_background_color'); $button_alt_text_color = get_theme_mod('storefront_button_alt_text_color'); $brighten_factor = apply_filters('storefront_brighten_factor', 25); $darken_factor = apply_filters('storefront_darken_factor', -25); $style = ' .main-navigation ul li a, .site-title a, ul.menu li a, .site-branding h1 a { color: ' . $header_link_color . '; } .main-navigation ul li a:hover, .main-navigation ul li:hover > a, .site-title a:hover, a.cart-contents:hover, .site-header-cart .widget_shopping_cart a:hover, .site-header-cart:hover > li > a { color: ' . storefront_adjust_color_brightness($header_link_color, 50) . '; } .site-header, .main-navigation ul ul, .secondary-navigation ul ul, .main-navigation ul.menu > li.menu-item-has-children:after, .secondary-navigation ul.menu ul, .main-navigation ul.menu ul, .main-navigation ul.nav-menu ul { background-color: ' . $header_background_color . '; } p.site-description, ul.menu li.current-menu-item > a, .site-header { color: ' . $header_text_color . '; } h1, h2, h3, h4, h5, h6 { color: ' . $heading_color . '; } .widget h1 { border-bottom-color: ' . $heading_color . '; } body, .secondary-navigation a, .widget-area .widget a, .onsale, #comments .comment-list .reply a, .pagination .page-numbers li .page-numbers:not(.current), .woocommerce-pagination .page-numbers li .page-numbers:not(.current) { color: ' . $text_color . '; } a { color: ' . $accent_color . '; } a:focus, .button:focus, .button.alt:focus, .button.added_to_cart:focus, .button.wc-forward:focus, button:focus, input[type="button"]:focus, input[type="reset"]:focus, input[type="submit"]:focus { outline-color: ' . $accent_color . '; } button, input[type="button"], input[type="reset"], input[type="submit"], .button, .added_to_cart, .widget-area .widget a.button, .site-header-cart .widget_shopping_cart a.button { background-color: ' . $button_background_color . '; border-color: ' . $button_background_color . '; color: ' . $button_text_color . '; } button:hover, input[type="button"]:hover, input[type="reset"]:hover, input[type="submit"]:hover, .button:hover, .added_to_cart:hover, .widget-area .widget a.button:hover, .site-header-cart .widget_shopping_cart a.button:hover { background-color: ' . storefront_adjust_color_brightness($button_background_color, $darken_factor) . '; border-color: ' . storefront_adjust_color_brightness($button_background_color, $darken_factor) . '; color: ' . $button_text_color . '; } button.alt, input[type="button"].alt, input[type="reset"].alt, input[type="submit"].alt, .button.alt, .added_to_cart.alt, .widget-area .widget a.button.alt, .added_to_cart, .pagination .page-numbers li .page-numbers.current, .woocommerce-pagination .page-numbers li .page-numbers.current { background-color: ' . $button_alt_background_color . '; border-color: ' . $button_alt_background_color . '; color: ' . $button_alt_text_color . '; } button.alt:hover, input[type="button"].alt:hover, input[type="reset"].alt:hover, input[type="submit"].alt:hover, .button.alt:hover, .added_to_cart.alt:hover, .widget-area .widget a.button.alt:hover, .added_to_cart:hover { background-color: ' . storefront_adjust_color_brightness($button_alt_background_color, $darken_factor) . '; border-color: ' . storefront_adjust_color_brightness($button_alt_background_color, $darken_factor) . '; color: ' . $button_alt_text_color . '; } .site-footer { background-color: ' . $footer_background_color . '; color: ' . $footer_text_color . '; } .site-footer a:not(.button) { color: ' . $footer_link_color . '; } .site-footer h1, .site-footer h2, .site-footer h3, .site-footer h4, .site-footer h5, .site-footer h6 { color: ' . $footer_heading_color . '; } #order_review { background-color: ' . storefront_get_content_background_color() . '; } @media screen and ( min-width: 768px ) { .main-navigation ul.menu > li > ul { border-top-color: ' . $header_background_color . '; } .secondary-navigation ul.menu a:hover { color: ' . storefront_adjust_color_brightness($header_text_color, $brighten_factor) . '; } .main-navigation ul.menu ul { background-color: ' . $header_background_color . '; } .secondary-navigation ul.menu a { color: ' . $header_text_color . '; } }'; $woocommerce_style = ' a.cart-contents, .site-header-cart .widget_shopping_cart a { color: ' . $header_link_color . '; } .site-header-cart .widget_shopping_cart { background-color: ' . $header_background_color . '; } .woocommerce-tabs ul.tabs li.active a, ul.products li.product .price, .onsale { color: ' . $text_color . '; } .onsale { border-color: ' . $text_color . '; } .star-rating span:before, .widget-area .widget a:hover, .product_list_widget a:hover, .quantity .plus, .quantity .minus, p.stars a:hover:after, p.stars a:after, .star-rating span:before { color: ' . $accent_color . '; } .widget_price_filter .ui-slider .ui-slider-range, .widget_price_filter .ui-slider .ui-slider-handle { background-color: ' . $accent_color . '; } #order_review_heading, #order_review { border-color: ' . $accent_color . '; } .woocommerce-breadcrumb { background-color: ' . storefront_adjust_color_brightness($background_color, 7) . '; } @media screen and ( min-width: 768px ) { .site-header-cart .widget_shopping_cart, .site-header .product_list_widget li .quantity { color: ' . $header_text_color . '; } }'; wp_add_inline_style('storefront-style', $style); wp_add_inline_style('storefront-woocommerce-style', $woocommerce_style); }
/** * Get all of the Storefront theme mods. * * @return array $storefront_theme_mods The Storefront Theme Mods. */ public function get_storefront_theme_mods() { $storefront_theme_mods = array('background_color' => storefront_get_content_background_color(), 'accent_color' => get_theme_mod('storefront_accent_color'), 'header_background_color' => get_theme_mod('storefront_header_background_color'), 'header_link_color' => get_theme_mod('storefront_header_link_color'), 'header_text_color' => get_theme_mod('storefront_header_text_color'), 'footer_background_color' => get_theme_mod('storefront_footer_background_color'), 'footer_link_color' => get_theme_mod('storefront_footer_link_color'), 'footer_heading_color' => get_theme_mod('storefront_footer_heading_color'), 'footer_text_color' => get_theme_mod('storefront_footer_text_color'), 'text_color' => get_theme_mod('storefront_text_color'), 'heading_color' => get_theme_mod('storefront_heading_color'), 'button_background_color' => get_theme_mod('storefront_button_background_color'), 'button_text_color' => get_theme_mod('storefront_button_text_color'), 'button_alt_background_color' => get_theme_mod('storefront_button_alt_background_color'), 'button_alt_text_color' => get_theme_mod('storefront_button_alt_text_color')); return apply_filters('storefront_theme_mods', $storefront_theme_mods); }
/** * Add styles for embeds */ public function print_embed_styles() { wp_enqueue_style('source-sans-pro', '//fonts.googleapis.com/css?family=Source+Sans+Pro:400,300,300italic,400italic,700,900'); $accent_color = get_theme_mod('storefront_accent_color'); $background_color = storefront_get_content_background_color(); ?> <style type="text/css"> .wp-embed { padding: 2.618em !important; border: 0 !important; border-radius: 3px !important; font-family: "Source Sans Pro", "Open Sans", sans-serif !important; -webkit-font-smoothing: antialiased; background-color: <?php echo storefront_adjust_color_brightness($background_color, -7); ?> !important; } .wp-embed .wp-embed-featured-image { margin-bottom: 2.618em; } .wp-embed .wp-embed-featured-image img, .wp-embed .wp-embed-featured-image.square { min-width: 100%; margin-bottom: .618em; } a.wc-embed-button { padding: .857em 1.387em !important; font-weight: 600; background-color: <?php echo esc_attr($accent_color); ?> ; color: #fff !important; border: 0 !important; line-height: 1; border-radius: 0 !important; box-shadow: inset 0 -1px 0 rgba(#000,.3); } a.wc-embed-button + a.wc-embed-button { background-color: #60646c; } </style> <?php }
/** * Enqueue CSS and custom styles. * @since 1.0.0 * @return void */ public function shcs_styles() { wp_enqueue_style('shcs-styles', plugins_url('/assets/css/style.css', __FILE__)); $bg_color = apply_filters('storefront_homepage_contact_section_bg', storefront_get_content_background_color()); $accent_color = get_theme_mod('storefront_accent_color', apply_filters('storefront_default_accent_color', '#FFA107')); $overlay_opacity = apply_filters('storefront_homepage_contact_section_overlay', 0.8); // Get RGB color of overlay from HEX if (Storefront_Homepage_Contact_Section::sanitize_hex_color($bg_color)) { list($r, $g, $b) = sscanf($bg_color, "#%02x%02x%02x"); } else { $r = $g = $b = 255; } $shcs_style = ' .storefront-homepage-contact-section .shcs-overlay { background-color: rgba(' . $r . ', ' . $g . ', ' . $b . ', ' . $overlay_opacity . '); } .storefront-homepage-contact-section .shcs-contact-details ul li:before { color: ' . $accent_color . '; }'; wp_add_inline_style('shcs-styles', $shcs_style); }