Skip to content

Commit f695d8c

Browse files
authored
Enable appearance tools via theme_support (#43337)
* Enable appearance tools via theme_support Co-authored-by: Jeff Ong <jonger4@gmail.com>
1 parent c4b2ca7 commit f695d8c

File tree

4 files changed

+23
-0
lines changed

4 files changed

+23
-0
lines changed

docs/how-to-guides/themes/theme-json.md

+1
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,7 @@ To retain backward compatibility, the existing `add_theme_support` declarations
334334
| `editor-font-sizes` | Provide the list of font size via `typography.fontSizes`. |
335335
| `editor-gradient-presets` | Provide the list of gradients via `color.gradients`. |
336336
| `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. |
337+
| `appearance-tools` | Set `appearanceTools` to `true`. |
337338

338339
#### Presets
339340

docs/how-to-guides/themes/theme-support.md

+13
Original file line numberDiff line numberDiff line change
@@ -463,3 +463,16 @@ where
463463
- `<link-color>` 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)
464464

465465
The block will get attached the class `.wp-elements-<uuid>`.
466+
467+
## Appearance Tools
468+
469+
Use this setting to enable the following Global Styles settings:
470+
471+
- border: color, radius, style, width
472+
- color: link
473+
- spacing: blockGap, margin, padding
474+
- typography: lineHeight
475+
476+
```php
477+
add_theme_support( 'appearance-tools' );
478+
```

lib/experimental/class-wp-theme-json-resolver-gutenberg.php

+5
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,11 @@ public static function get_theme_data( $deprecated = array(), $settings = array(
9292

9393
// Classic themes without a theme.json don't support global duotone.
9494
$theme_support_data['settings']['color']['defaultDuotone'] = false;
95+
96+
// Allow themes to enable appearance tools via theme_support.
97+
if ( current_theme_supports( 'appearance-tools' ) ) {
98+
$theme_support_data['settings']['appearanceTools'] = true;
99+
}
95100
}
96101
$with_theme_supports = new WP_Theme_JSON_Gutenberg( $theme_support_data );
97102
$with_theme_supports->merge( static::$theme );

packages/core-data/src/entity-types/theme.ts

+4
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ declare module './base-entity-records' {
7878
* Whether theme opts in to wide alignment CSS class.
7979
*/
8080
'align-wide': boolean;
81+
/**
82+
* Whether appearanceTools are enabled in Global Styles.
83+
*/
84+
'appearance-tools': boolean;
8185
/**
8286
* Whether posts and comments RSS feed links are added to head.
8387
*/

0 commit comments

Comments
 (0)