diff --git a/docs/how-to-guides/themes/theme-json.md b/docs/how-to-guides/themes/theme-json.md index 4a3dc8f70a85e6..2212f98a1c870c 100644 --- a/docs/how-to-guides/themes/theme-json.md +++ b/docs/how-to-guides/themes/theme-json.md @@ -342,8 +342,8 @@ To retain backward compatibility, the existing `add_theme_support` declarations | `editor-color-palette` | Provide the list of colors via `color.palette`. | | `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`. | +| `link-color ` | Set `color.link` to `true`. | #### Presets diff --git a/docs/how-to-guides/themes/theme-support.md b/docs/how-to-guides/themes/theme-support.md index 423c8c6a4e2815..45402691795cdc 100644 --- a/docs/how-to-guides/themes/theme-support.md +++ b/docs/how-to-guides/themes/theme-support.md @@ -477,6 +477,14 @@ Use this setting to enable the following Global Styles settings: add_theme_support( 'appearance-tools' ); ``` +## Link color + +Use this to enable the link color setting: + +```php +add_theme_support( 'link-color' ); +``` + ## Block Based Template Parts Block Based Template parts allow administrators to edit parts of the site using blocks. This is off by default, and requires the theme to opt in by declaring support: diff --git a/lib/class-wp-theme-json-resolver-gutenberg.php b/lib/class-wp-theme-json-resolver-gutenberg.php index 33fd4defd51917..73cae004bfbad2 100644 --- a/lib/class-wp-theme-json-resolver-gutenberg.php +++ b/lib/class-wp-theme-json-resolver-gutenberg.php @@ -319,6 +319,18 @@ public static function get_theme_data( $deprecated = array(), $options = array() // Classic themes without a theme.json don't support global duotone. $theme_support_data['settings']['color']['defaultDuotone'] = false; + // Allow themes to enable link colors via theme_support. + if ( current_theme_supports( 'link-color' ) ) { + $theme_support_data['settings']['color']['link'] = true; + } + if ( current_theme_supports( 'experimental-link-color' ) ) { + _doing_it_wrong( + current_theme_supports( 'experimental-link-color' ), + __( '`experimental-link-color` is no longer supported. Use `link-color` instead.', 'gutenberg' ), + '6.3.0' + ); + } + // BEGIN EXPERIMENTAL. // Allow themes to enable appearance tools via theme_support. // This feature was backported for WordPress 6.2 as of https://core.trac.wordpress.org/ticket/56487 diff --git a/packages/core-data/src/entity-types/theme.ts b/packages/core-data/src/entity-types/theme.ts index 04904ae2501f00..6e15738dd992e0 100644 --- a/packages/core-data/src/entity-types/theme.ts +++ b/packages/core-data/src/entity-types/theme.ts @@ -141,6 +141,10 @@ declare module './base-entity-records' { * Post formats supported. */ formats: PostFormat[]; + /** + * Whether link colors are enabled. + */ + 'link-color': boolean; /** * The post types that support thumbnails or true if all post types are supported. */