Make WordPress Core


Ignore:
Timestamp:
12/14/2018 07:08:06 PM (6 years ago)
Author:
allancole
Message:

Updating Twenty Nineteen, the new default theme for 2019.

This change adds general code quality and documentation improvements.

Props grapplerulrich, iCaleb.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/5.0/src/wp-content/themes/twentynineteen/inc/color-patterns.php

    r43909 r44187  
    1313function twentynineteen_custom_colors_css() {
    1414
    15     if ( 'default' === get_theme_mod( 'primary_color', 'default' ) ) {
    16         $primary_color = 199;
    17     } else {
    18         $primary_color = absint( get_theme_mod( 'primary_color_hue', 199 ) );
     15    $primary_color = 199;
     16    if ( 'default' !== get_theme_mod( 'primary_color', 'default' ) ) {
     17        $primary_color = absint( get_theme_mod( 'primary_color', 199 ) );
    1918    }
    2019
     
    2625     * @param int $saturation Color saturation level.
    2726     */
    28 
    29     $saturation           = absint( apply_filters( 'twentynineteen_custom_colors_saturation', 100 ) );
    30     $saturation           = $saturation . '%';
    31 
     27    $saturation = apply_filters( 'twentynineteen_custom_colors_saturation', 100 );
     28    $saturation = absint( $saturation ) . '%';
     29
     30    /**
     31     * Filter Twenty Nineteen default selection saturation level.
     32     *
     33     * @since Twenty Nineteen 1.0
     34     *
     35     * @param int $saturation_selection Selection color saturation level.
     36     */
    3237    $saturation_selection = absint( apply_filters( 'twentynineteen_custom_colors_saturation_selection', 50 ) );
    3338    $saturation_selection = $saturation_selection . '%';
    3439
    35     $lightness            = absint( apply_filters( 'twentynineteen_custom_colors_lightness', 33 ) );
    36     $lightness            = $lightness . '%';
    37 
    38     $lightness_hover      = absint( apply_filters( 'twentynineteen_custom_colors_lightness_hover', 23 ) );
    39     $lightness_hover      = $lightness_hover . '%';
    40 
    41     $lightness_selection  = absint( apply_filters( 'twentynineteen_custom_colors_lightness_selection', 90 ) );
    42     $lightness_selection  = $lightness_selection . '%';
     40    /**
     41     * Filter Twenty Nineteen default lightness level.
     42     *
     43     * @since Twenty Nineteen 1.0
     44     *
     45     * @param int $lightness Color lightness level.
     46     */
     47    $lightness = apply_filters( 'twentynineteen_custom_colors_lightness', 33 );
     48    $lightness = absint( $lightness ) . '%';
     49
     50    /**
     51     * Filter Twenty Nineteen default hover lightness level.
     52     *
     53     * @since Twenty Nineteen 1.0
     54     *
     55     * @param int $lightness_hover Hover color lightness level.
     56     */
     57    $lightness_hover = apply_filters( 'twentynineteen_custom_colors_lightness_hover', 23 );
     58    $lightness_hover = absint( $lightness_hover ) . '%';
     59
     60    /**
     61     * Filter Twenty Nineteen default selection lightness level.
     62     *
     63     * @since Twenty Nineteen 1.0
     64     *
     65     * @param int $lightness_selection Selection color lightness level.
     66     */
     67    $lightness_selection = apply_filters( 'twentynineteen_custom_colors_lightness_selection', 90 );
     68    $lightness_selection = absint( $lightness_selection ) . '%';
    4369
    4470    $theme_css = '
     
    234260        }
    235261        ';
    236     $css = '';
     262
    237263    if ( function_exists( 'register_block_type' ) && is_admin() ) {
    238         $css .= $editor_css;
    239     } else if ( ! is_admin() ) {
    240         $css = $theme_css;
     264        $theme_css = $editor_css;
    241265    }
    242266
     
    250274     * @param string $saturation    Filtered theme color saturation level.
    251275     */
    252     return apply_filters( 'twentynineteen_custom_colors_css', $css, $primary_color, $saturation );
     276    return apply_filters( 'twentynineteen_custom_colors_css', $theme_css, $primary_color, $saturation );
    253277}
Note: See TracChangeset for help on using the changeset viewer.