Twenty Seventeen: Allow child themes to easily extend custom color patterns

By adding a filter, child themes can add additional selectors onto the custom color scheme CSS. Like so:

{{{
// Add child theme selectors for color schemes.
function dynamic_seventeen_custom_colors_css( $css, $hue, $saturation ) {
	$css .= '
	.colors-custom .content-menu > article:not(.has-post-thumbnail),
	.colors-custom .content-menu > section:not(.has-post-thumbnail) {
		border-top-color: hsl( ' . $hue . ', ' . $saturation . ', 87% ); /* base: #ddd; */
	}';
	return $css;
}
add_filter( 'twentyseventeen_custom_colors_css', 'dynamic_seventeen_custom_colors_css', 10, 3 );
}}}

Merge of [39386] to the 4.7 branch.

Props celloexpressions.
See #38949.

git-svn-id: https://develop.svn.wordpress.org/branches/4.7@39387 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Dominik Schilling (ocean90) 2016-11-30 22:56:08 +00:00
parent b0a9a79f86
commit b07efe6c1f
1 changed files with 11 additions and 1 deletions

View File

@ -557,5 +557,15 @@ body.colors-custom,
}
}';
return $css;
/**
* Filters Twenty Seventeen custom colors CSS.
*
* @since Twenty Seventeen 1.0
*
* @param $css string Base theme colors CSS.
* @param $hue int The user's selected color hue.
* @param $saturation string Filtered theme color saturation level.
*/
return apply_filters( 'twentyseventeen_custom_colors_css', $css, $hue, $saturation );
}