updated theme GeneratePress version 3.0.3

This commit is contained in:
2021-03-03 13:57:37 +00:00
committed by Gitium
parent a60ce58ddd
commit a366a73cba
6 changed files with 53 additions and 28 deletions

View File

@ -76,15 +76,6 @@ jQuery( document ).ready( function( $ ) {
body.addClass( 'content-title-hidden' );
}
} );
if ( generate_block_editor.show_editor_styles ) {
var text_color = tinycolor( generate_block_editor.text_color ).toHex8(),
isTextDark = tinycolor( text_color ).isDark();
if ( ! isTextDark ) {
$( 'body' ).addClass( 'is-dark-theme' );
}
}
} );
jQuery( window ).on( 'load', function() {
@ -95,4 +86,18 @@ jQuery( window ).on( 'load', function() {
post_title_block.append( '<button class="content-title-visibility disable-content-title" title="' + generate_block_editor.disable_content_title + '" aria-hidden="true"></button>' );
post_title_block.append( '<button class="content-title-visibility show-content-title" title="' + generate_block_editor.show_content_title + '" aria-hidden="true"></button>' );
}
// This is a fallback in case the core editor check for the dark theme fails.
// If the background is using a gradient or rgba, the WP method can be wrong.
// So instead, we check for text color, as it's a better indicator of the true background color.
if ( generate_block_editor.show_editor_styles ) {
var text_color = tinycolor( generate_block_editor.text_color ).toHex8(),
isTextDark = tinycolor( text_color ).isDark();
if ( ! isTextDark ) {
document.body.classList.add( 'is-dark-theme' );
} else {
document.body.classList.remove( 'is-dark-theme' );
}
}
} );