From eeeae19f8d96e236bd3b24a434c496978bab8f10 Mon Sep 17 00:00:00 2001 From: tellthemachines Date: Tue, 19 Dec 2023 15:53:59 +1100 Subject: [PATCH 1/3] Make sure theme color palette preset styles are output. --- lib/global-styles-and-settings.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/global-styles-and-settings.php b/lib/global-styles-and-settings.php index 03c8de10a8925..8508993a2a4ad 100644 --- a/lib/global-styles-and-settings.php +++ b/lib/global-styles-and-settings.php @@ -72,7 +72,7 @@ function gutenberg_get_global_stylesheet( $types = array() ) { * @see wp_add_global_styles_for_blocks */ $origins = array( 'default', 'theme', 'custom' ); - if ( ! $supports_theme_json ) { + if ( ! $supports_theme_json && ! current_theme_supports( 'appearance-tools' ) ) { $origins = array( 'default' ); } $styles_rest = $tree->get_stylesheet( $types, $origins ); From e3011346ad4a32ae1e9fed65729bffc39a5d2916 Mon Sep 17 00:00:00 2001 From: tellthemachines Date: Tue, 19 Dec 2023 16:24:06 +1100 Subject: [PATCH 2/3] Check for color palette support --- lib/global-styles-and-settings.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/global-styles-and-settings.php b/lib/global-styles-and-settings.php index 8508993a2a4ad..65cfc42c5939f 100644 --- a/lib/global-styles-and-settings.php +++ b/lib/global-styles-and-settings.php @@ -72,7 +72,13 @@ function gutenberg_get_global_stylesheet( $types = array() ) { * @see wp_add_global_styles_for_blocks */ $origins = array( 'default', 'theme', 'custom' ); - if ( ! $supports_theme_json && ! current_theme_supports( 'appearance-tools' ) ) { + /* + * If the theme doesn't have theme.json but supports both appearance tools and color palette, + * the 'theme' origin should be included so color palette presets are also output. + */ + if ( ! $supports_theme_json && current_theme_supports( 'appearance-tools' ) && current_theme_supports( 'editor-color-palette' ) ) { + $origins = array( 'default', 'theme' ); + } elseif ( ! $supports_theme_json ) { $origins = array( 'default' ); } $styles_rest = $tree->get_stylesheet( $types, $origins ); From da5ad047329242d21456ba0463a08fb66d23bb3d Mon Sep 17 00:00:00 2001 From: tellthemachines Date: Wed, 20 Dec 2023 11:31:43 +1100 Subject: [PATCH 3/3] Also check for border support. --- lib/global-styles-and-settings.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/global-styles-and-settings.php b/lib/global-styles-and-settings.php index 65cfc42c5939f..7a7a91e736866 100644 --- a/lib/global-styles-and-settings.php +++ b/lib/global-styles-and-settings.php @@ -76,7 +76,7 @@ function gutenberg_get_global_stylesheet( $types = array() ) { * If the theme doesn't have theme.json but supports both appearance tools and color palette, * the 'theme' origin should be included so color palette presets are also output. */ - if ( ! $supports_theme_json && current_theme_supports( 'appearance-tools' ) && current_theme_supports( 'editor-color-palette' ) ) { + if ( ! $supports_theme_json && ( current_theme_supports( 'appearance-tools' ) || current_theme_supports( 'border' ) ) && current_theme_supports( 'editor-color-palette' ) ) { $origins = array( 'default', 'theme' ); } elseif ( ! $supports_theme_json ) { $origins = array( 'default' );