예제 #1
0
/**
 * Enqueues front-end CSS for color scheme.
 *
 * @since Twenty Sixteen 1.0
 *
 * @see wp_add_inline_style()
 */
function twentysixteen_child_color_scheme_css()
{
    $color_scheme_option = get_theme_mod('color_scheme', 'default');
    // Don't do anything if the default color scheme is selected.
    if ('default' === $color_scheme_option) {
        return;
    }
    $color_scheme = twentysixteen_get_color_scheme();
    // Convert main text hex color to rgba.
    $color_textcolor_rgb = twentysixteen_hex2rgb($color_scheme[3]);
    // If the rgba values are empty return early.
    if (empty($color_textcolor_rgb)) {
        return;
    }
    // If we get this far, we have a custom color scheme.
    $colors = array('background_color' => $color_scheme[0], 'page_background_color' => $color_scheme[1], 'link_color' => $color_scheme[2], 'main_text_color' => $color_scheme[3], 'secondary_text_color' => $color_scheme[4], 'border_color' => vsprintf('rgba( %1$s, %2$s, %3$s, 0.2)', $color_textcolor_rgb), 'header_text_color' => $color_scheme[5]);
    $color_scheme_css = twentysixteen_child_get_color_scheme_css($colors);
    wp_add_inline_style('twentysixteen-child-style', $color_scheme_css);
}
예제 #2
0
/**
 * Enqueues front-end CSS for the main text color.
 *
 * @since www.ziedbouhejba.com 1.0
 *
 * @see wp_add_inline_style()
 */
function twentysixteen_main_text_color_css()
{
    $color_scheme = twentysixteen_get_color_scheme();
    $default_color = $color_scheme[3];
    $main_text_color = get_theme_mod('main_text_color', $default_color);
    // Don't do anything if the current color is the default.
    if ($main_text_color === $default_color) {
        return;
    }
    // Convert main text hex color to rgba.
    $main_text_color_rgb = twentysixteen_hex2rgb($main_text_color);
    // If the rgba values are empty return early.
    if (empty($main_text_color_rgb)) {
        return;
    }
    // If we get this far, we have a custom color scheme.
    $border_color = vsprintf('rgba( %1$s, %2$s, %3$s, 0.2)', $main_text_color_rgb);
    $css = '
		/* Custom Main Text Color */
		body,
		blockquote cite,
		blockquote small,
		.main-navigation a,
		.menu-toggle,
		.dropdown-toggle,
		.social-navigation a,
		.post-navigation a,
		.pagination a:hover,
		.pagination a:focus,
		.widget-title a,
		.site-branding .site-title a,
		.entry-title a,
		.page-links > .page-links-title,
		.comment-author,
		.comment-reply-title small a:hover,
		.comment-reply-title small a:focus {
			color: %1$s
		}

		blockquote,
		.menu-toggle.toggled-on,
		.menu-toggle.toggled-on:hover,
		.menu-toggle.toggled-on:focus,
		.post-navigation,
		.post-navigation div + div,
		.pagination,
		.widget,
		.page-header,
		.page-links a,
		.comments-title,
		.comment-reply-title {
			border-color: %1$s;
		}

		button,
		button[disabled]:hover,
		button[disabled]:focus,
		input[type="button"],
		input[type="button"][disabled]:hover,
		input[type="button"][disabled]:focus,
		input[type="reset"],
		input[type="reset"][disabled]:hover,
		input[type="reset"][disabled]:focus,
		input[type="submit"],
		input[type="submit"][disabled]:hover,
		input[type="submit"][disabled]:focus,
		.menu-toggle.toggled-on,
		.menu-toggle.toggled-on:hover,
		.menu-toggle.toggled-on:focus,
		.pagination:before,
		.pagination:after,
		.pagination .prev,
		.pagination .next,
		.page-links a {
			background-color: %1$s;
		}

		/* Border Color */
		fieldset,
		pre,
		abbr,
		acronym,
		table,
		th,
		td,
		input[type="text"],
		input[type="email"],
		input[type="url"],
		input[type="password"],
		input[type="search"],
		textarea,
		.main-navigation li,
		.main-navigation .primary-menu,
		.menu-toggle,
		.dropdown-toggle:after,
		.social-navigation a,
		.image-navigation,
		.comment-navigation,
		.tagcloud a,
		.entry-content,
		.entry-summary,
		.page-links a,
		.page-links > span,
		.comment-list article,
		.comment-list .pingback,
		.comment-list .trackback,
		.comment-reply-link,
		.no-comments,
		.widecolumn .mu_register .mu_alert {
			border-color: %1$s; /* Fallback for IE7 and IE8 */
			border-color: %2$s;
		}

		hr,
		code {
			background-color: %1$s; /* Fallback for IE7 and IE8 */
			background-color: %2$s;
		}

		@media screen and (min-width: 56.875em) {
			.main-navigation ul ul,
			.main-navigation ul ul li {
				border-color: %2$s;
			}

			.main-navigation ul ul:before {
				border-top-color: %2$s;
				border-bottom-color: %2$s;
			}
		}
	';
    wp_add_inline_style('twentysixteen-style', sprintf($css, $main_text_color, $border_color));
}
예제 #3
0
/**
 * Enqueues front-end CSS for the main text color.
 *
 * @since Twenty Sixteen 1.0
 *
 * @see wp_add_inline_style()
 */
function twentysixteen_main_text_color_css()
{
    $color_scheme = twentysixteen_get_color_scheme();
    $default_color = $color_scheme[3];
    $main_text_color = get_theme_mod('main_text_color', $default_color);
    // Don't do anything if the current color is the default.
    if ($main_text_color === $default_color) {
        return;
    }
    // Convert main text hex color to rgba.
    $main_text_color_rgb = twentysixteen_hex2rgb($main_text_color);
    // If the rgba values are empty return early.
    if (empty($main_text_color_rgb)) {
        return;
    }
    // If we get this far, we have a custom color scheme.
    $border_color = vsprintf('rgba( %1$s, %2$s, %3$s, 0.1)', $main_text_color_rgb);
    $css = '
		/* Custom Main Text Color */
		body,
		select,
		blockquote cite,
		blockquote small,
		.main-navigation a,
		.menu-toggle,
		.dropdown-toggle,
		.social-navigation a:before,
		.post-navigation a,
		.pagination a:hover,
		.pagination a:focus,
		.widget-title a,
		.site-title a,
		.entry-title a,
		.page-links > .page-links-title,
		.comment-author,
		.comment-reply-title small a:hover,
		.comment-reply-title small a:focus {
			color: %1$s
		}

		/* 
		IE8 and earlier will drop any block with CSS3 selectors. Do not
		combine these styles with the next block.
		*/
		body:not(.error404):not(.search-no-results) .page-header {
			border-color: %1$s;
		}
		
		/* 
		IE8 and earlier will drop any block with CSS3 selectors. Do not
		combine these styles with the previous block.
		*/
		blockquote,
		.menu-toggle.toggled-on,
		.menu-toggle.toggled-on:hover,
		.menu-toggle.toggled-on:focus,
		.post-navigation,
		.post-navigation div + div,
		.pagination,
		.widget,
		.page-links a,
		.comments-title,
		.comment-reply-title {
			border-color: %1$s;
		}

		.menu-toggle.toggled-on,
		.menu-toggle.toggled-on:hover,
		.menu-toggle.toggled-on:focus,
		.pagination:before,
		.pagination:after,
		.pagination .prev,
		.pagination .next,
		.page-links a {
			background-color: %1$s;
		}

		/* Border Color */
		fieldset,
		pre,
		abbr,
		acronym,
		hr,
		table,
		th,
		td,
		input[type="text"],
		input[type="email"],
		input[type="url"],
		input[type="password"],
		input[type="search"],
		textarea,
		.main-navigation li,
		.main-navigation .primary-menu,
		.menu-toggle,
		.dropdown-toggle:after,
		.social-navigation a,
		.image-navigation,
		.comment-navigation,
		.tagcloud a,
		.author-info,
		.page-links a,
		.page-links > span,
		.comment-list article,
		.comment-list .pingback,
		.comment-list .trackback,
		.comment-reply-link,
		.no-comments {
			border-color: %2$s;
		}

		hr,
		code {
			background-color: %2$s;
		}

		@media screen and (min-width: 56.875em) {
			.main-navigation ul ul,
			.main-navigation ul ul li {
				border-color: %2$s;
			}

			.main-navigation ul ul:before {
				border-top-color: %2$s;
				border-bottom-color: %2$s;
			}
		}
	';
    wp_add_inline_style('twentysixteen-style', sprintf($css, $main_text_color, $border_color));
}