Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/wp-content/themes/twentynineteen/inc/customizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ function twentynineteen_customize_register( $wp_customize ) {
$wp_customize,
'primary_color_hue',
array(
'label' => __( 'Custom Color', 'twentynineteen' ),
'description' => __( 'Apply a custom color for buttons, links, featured images, etc.', 'twentynineteen' ),
'section' => 'colors',
'mode' => 'hue',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
control.container.slideUp( 180 );
}
};

// The control-specific label is redundant because, visually, this control is part of the Color Scheme control.
control.container.find( '.customize-control-title:first' ).addClass( 'screen-reader-text' );
visibility();
setting.bind( visibility );
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
control.container.slideUp( 180 );
}
};

// The control-specific label is redundant because, visually, this control is part of the Color Scheme control.
control.container.find( '.customize-control-title:first' ).addClass( 'screen-reader-text' );
visibility();
setting.bind( visibility );
});
Expand Down
1 change: 1 addition & 0 deletions src/wp-content/themes/twentyseventeen/inc/customizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ function twentyseventeen_customize_register( $wp_customize ) {
$wp_customize,
'colorscheme_hue',
array(
'label' => __( 'Hue', 'twentyseventeen' ),
'mode' => 'hue',
'section' => 'colors',
'priority' => 6,
Expand Down
2 changes: 2 additions & 0 deletions src/wp-content/themes/twentytwenty/assets/js/customize.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
}
} );
}
// The control-specific label is redundant because, visually, this control is part of the Color Scheme control.
control.container.find( '.customize-control-title:first' ).addClass( 'screen-reader-text' );
} );
} );
}( jQuery, wp.customize ) );
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ public static function register( $wp_customize ) {
array(
'section' => 'colors',
'settings' => 'accent_hue',
'label' => __( 'Custom Color', 'twentytwenty' ),
'description' => __( 'Apply a custom color for links, buttons, featured images.', 'twentytwenty' ),
'mode' => 'hue',
'active_callback' => static function () use ( $wp_customize ) {
Expand Down
16 changes: 10 additions & 6 deletions src/wp-includes/customize/class-wp-customize-color-control.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,30 +92,34 @@ public function render_content() {}
*/
public function content_template() {
?>
<# var defaultValue = '#RRGGBB', defaultValueAttr = '',
<#
var defaultValue = '#RRGGBB',
defaultValueAttr = '',
inputId = _.uniqueId( 'customize-color-control-input-' ),
isHueSlider = data.mode === 'hue';

if ( data.defaultValue && _.isString( data.defaultValue ) && ! isHueSlider ) {
if ( '#' !== data.defaultValue.substring( 0, 1 ) ) {
defaultValue = '#' + data.defaultValue;
} else {
defaultValue = data.defaultValue;
}
defaultValueAttr = ' data-default-color=' + defaultValue; // Quotes added automatically.
} #>
}
#>
<# if ( data.label ) { #>
<span class="customize-control-title">{{{ data.label }}}</span>
<# } #>
<# if ( data.description ) { #>
<span class="description customize-control-description">{{{ data.description }}}</span>
<# } #>
<div class="customize-control-content">
<label><span class="screen-reader-text">{{{ data.label }}}</span>
<label for="{{ inputId }}"><span class="screen-reader-text">{{{ data.label }}}</span></label>
<# if ( isHueSlider ) { #>
<input class="color-picker-hue" type="text" data-type="hue" />
<input id="{{ inputId }}" class="color-picker-hue" type="number" min="1" max="359" data-type="hue" />
<# } else { #>
<input class="color-picker-hex" type="text" maxlength="7" placeholder="{{ defaultValue }}" {{ defaultValueAttr }} />
<input id="{{ inputId }}" class="color-picker-hex" type="text" maxlength="7" placeholder="{{ defaultValue }}" {{ defaultValueAttr }} />
<# } #>
</label>
</div>
<?php
}
Expand Down
Loading