diff --git a/docs/how-to-guides/themes/theme-json.md b/docs/how-to-guides/themes/theme-json.md index 9414d6adecb13..e96c4a5c4ac94 100644 --- a/docs/how-to-guides/themes/theme-json.md +++ b/docs/how-to-guides/themes/theme-json.md @@ -334,6 +334,7 @@ To retain backward compatibility, the existing `add_theme_support` declarations | `editor-font-sizes` | Provide the list of font size via `typography.fontSizes`. | | `editor-gradient-presets` | Provide the list of gradients via `color.gradients`. | | `experimental-link-color` | Set `color.link` to `true`. `experimental-link-color` will be removed when the plugin requires WordPress 5.9 as the minimum version. | +| `appearance-tools` | Set `appearanceTools` to `true`. | #### Presets diff --git a/docs/how-to-guides/themes/theme-support.md b/docs/how-to-guides/themes/theme-support.md index 1d1f42cb7629a..e7c015fe62113 100644 --- a/docs/how-to-guides/themes/theme-support.md +++ b/docs/how-to-guides/themes/theme-support.md @@ -463,3 +463,16 @@ where - `` is either `var(--wp--preset--color--slug)` (if the user selected a preset value) or a raw color value (if the user selected a custom value) The block will get attached the class `.wp-elements-`. + +## Appearance Tools + +Use this setting to enable the following Global Styles settings: + +- border: color, radius, style, width +- color: link +- spacing: blockGap, margin, padding +- typography: lineHeight + +```php +add_theme_support( 'appearance-tools' ); +``` diff --git a/lib/experimental/class-wp-theme-json-resolver-gutenberg.php b/lib/experimental/class-wp-theme-json-resolver-gutenberg.php index a4d4e4dfc7066..138f9b8b865b4 100644 --- a/lib/experimental/class-wp-theme-json-resolver-gutenberg.php +++ b/lib/experimental/class-wp-theme-json-resolver-gutenberg.php @@ -92,6 +92,11 @@ public static function get_theme_data( $deprecated = array(), $settings = array( // Classic themes without a theme.json don't support global duotone. $theme_support_data['settings']['color']['defaultDuotone'] = false; + + // Allow themes to enable appearance tools via theme_support. + if ( current_theme_supports( 'appearance-tools' ) ) { + $theme_support_data['settings']['appearanceTools'] = true; + } } $with_theme_supports = new WP_Theme_JSON_Gutenberg( $theme_support_data ); $with_theme_supports->merge( static::$theme ); diff --git a/packages/core-data/src/entity-types/theme.ts b/packages/core-data/src/entity-types/theme.ts index d5f7db3da573d..26d70a92007d5 100644 --- a/packages/core-data/src/entity-types/theme.ts +++ b/packages/core-data/src/entity-types/theme.ts @@ -78,6 +78,10 @@ declare module './base-entity-records' { * Whether theme opts in to wide alignment CSS class. */ 'align-wide': boolean; + /** + * Whether appearanceTools are enabled in Global Styles. + */ + 'appearance-tools': boolean; /** * Whether posts and comments RSS feed links are added to head. */