Skip to content
This repository has been archived by the owner on Dec 1, 2019. It is now read-only.

Cover image overlay opacity should use a range control #276

Closed
celloexpressions opened this issue Sep 14, 2019 · 4 comments
Closed

Cover image overlay opacity should use a range control #276

celloexpressions opened this issue Sep 14, 2019 · 4 comments
Labels
enhancement New feature or request

Comments

@celloexpressions
Copy link

The cover image overlay opacity is currently a select control with 11 options at increments of 10%. This would be more appropriate as a range (slider) control, because most users will not care about the numerical value of this option, and the range approach allows for a more-visual interaction. This should also be instant live-previewed in the customizer with postMessage for instant feedback.

image

I'm not set up to create a PR yet, but this is the revised customize control code (someone else can feel free to make this into a PR):

/* Overlay Color Opacity --------- */
$wp_customize->add_setting(
	'twentytwenty_cover_template_overlay_opacity',
	array(
		'default'           => 80,
		'sanitize_callback' => 'absint',
	)
);

$wp_customize->add_control(
	'twentytwenty_cover_template_overlay_opacity',
	array(
		'label'       => __( 'Image Overlay Opacity', 'twentytwenty' ),
		'description' => __( 'Make sure that the value is high enough that the text is readable.', 'twentytwenty' ),
		'section'     => 'twentytwenty_cover_template_options',
		'type'        => 'range',
		'input_attrs' => array(
			'min'  => 0,
			'max'  => 100,
			'step' => 10,
		),
	)
)

The step of 10 matches the current options; I would suggest using a step of 5 instead for more-granular control. This also transitions the setting to be saved as an integer, and the output should be adjusted accordingly. Also note that the settings parameter in the control is not required when the control ID matches the setting ID.

@joyously
Copy link

I think this is a good idea. Should the min be more than 0? Or max less than 100?

@carolinan carolinan added the enhancement New feature or request label Sep 15, 2019
@acosmin
Copy link
Contributor

acosmin commented Sep 15, 2019

I could probably add this to #258 and also make the necessary changes for parameter in the control is not required when the control ID matches the setting ID where it's needed

@carolinan
Copy link
Contributor

I think this or some version of it will be part of #284 /#249

@LittleBigThing
Copy link
Contributor

I think this is a good idea. Should the min be more than 0? Or max less than 100?

See #470 about this. I would go for 0 as a minimum, but limit it to less than 100%.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants