Make WordPress Core

Changeset 56935

Timestamp:
10/14/2023 12:20:25 PM (10 months ago)
Author:
SergeyBiryukov
Message:

Twenty Nineteen: Correctly display default color names in the color palette.

Instead of displaying the color names, two of the default colors displayed the color code, which was only intended to show when the user has enabled the custom color option in the Customizer.

The reason is that the default value for the option is false, and this value is changed to the string 'custom' if the color option is enabled, and the string 'default' if the custom color is enabled and then reset to default colors.

This commit adjusts the logic for displaying the color name, to make sure that the string value 'default' is not compared with false, by adding the default value as a parameter to get_theme_mod( 'primary_color' ).

Follow-up to [45964].

Props poena, mukesh27, ugyensupport, shailu25, anveshika, harshgajipara, nicolefurlan, syamraj24, balub, vivekawsm.
Fixes #59566.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-content/themes/twentynineteen/functions.php

    r56556 r56935  
    140140            array(
    141141                array(
    142                     'name'  => 'default' === get_theme_mod( 'primary_color' ) ? __( 'Blue', 'twentynineteen' ) : null,
     142                    'name'  => 'default' === get_theme_mod( 'primary_color' ) ? __( 'Blue', 'twentynineteen' ) : null,
    143143                    'slug'  => 'primary',
    144144                    'color' => twentynineteen_hsl_hex( 'default' === get_theme_mod( 'primary_color' ) ? 199 : get_theme_mod( 'primary_color_hue', 199 ), 100, 33 ),
    145145                ),
    146146                array(
    147                     'name'  => 'default' === get_theme_mod( 'primary_color' ) ? __( 'Dark Blue', 'twentynineteen' ) : null,
     147                    'name'  => 'default' === get_theme_mod( 'primary_color' ) ? __( 'Dark Blue', 'twentynineteen' ) : null,
    148148                    'slug'  => 'secondary',
    149149                    'color' => twentynineteen_hsl_hex( 'default' === get_theme_mod( 'primary_color' ) ? 199 : get_theme_mod( 'primary_color_hue', 199 ), 100, 23 ),
Note: See TracChangeset for help on using the changeset viewer.