CoreFiles by mySites.guru
customize.js25 lines, 1,029 bytes, from wordpress-5.6.21.zip
Raw History Compare with 5.6.20
md5
f558d21bc735d41f25130bae248e9cd8
sha1
95c887c1512cdbae2a2035976369f0987e207612
sha256
0c40c65713979a3b72c4ad8dbc79670ead80c57614c5cde44075745c4adacbe8
/* global twentytwentyoneGetHexLum */

( function() {
	// Wait until the customizer has finished loading.
	wp.customize.bind( 'ready', function() {
		// Hide the "respect_user_color_preference" setting if the background-color is dark.
		if ( 127 > twentytwentyoneGetHexLum( wp.customize( 'background_color' ).get() ) ) {
			wp.customize.control( 'respect_user_color_preference' ).deactivate();
			wp.customize.control( 'respect_user_color_preference_notice' ).deactivate();
		}

		// Handle changes to the background-color.
		wp.customize( 'background_color', function( setting ) {
			setting.bind( function( value ) {
				if ( 127 > twentytwentyoneGetHexLum( value ) ) {
					wp.customize.control( 'respect_user_color_preference' ).deactivate();
					wp.customize.control( 'respect_user_color_preference_notice' ).activate();
				} else {
					wp.customize.control( 'respect_user_color_preference' ).activate();
					wp.customize.control( 'respect_user_color_preference_notice' ).deactivate();
				}
			} );
		} );
	} );
}() );

The same content is in 245 releases, WordPress 5.6-RC1 to 6.4-RC4. See them all, or every version of this file.