WordPress.org

Make WordPress Core

Changeset 39386


Ignore:
Timestamp:
11/30/2016 10:50:40 PM (18 months ago)
Author:
davidakennedy
Message:

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 );

Props celloexpressions.

Fixes #38949.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-content/themes/twentyseventeen/inc/color-patterns.php

    r39243 r39386  
    558558}';
    559559
    560     return $css;
    561 }
     560
     561    /**
     562     * Filters Twenty Seventeen custom colors CSS.
     563     *
     564     * @since Twenty Seventeen 1.0
     565     *
     566     * @param $css        string Base theme colors CSS.
     567     * @param $hue        int    The user's selected color hue.
     568     * @param $saturation string Filtered theme color saturation level.
     569     */
     570    return apply_filters( 'twentyseventeen_custom_colors_css', $css, $hue, $saturation );
     571}
Note: See TracChangeset for help on using the changeset viewer.