Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/how-to-guides/themes/theme-json.md
Original file line number Diff line number Diff line change
Expand Up @@ -226,9 +226,13 @@ The settings section has the following structure:
},
"color": {
"background": true,
"corePalette": true,
"coreGradients": true,
"custom": true,
"customDuotone": true,
"customGradient": true,
"corePalette": true,
"coreGradients": true,
"duotone": [],
"gradients": [],
"link": false,
Expand Down
2 changes: 2 additions & 0 deletions lib/class-wp-theme-json-gutenberg.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ class WP_Theme_JSON_Gutenberg {
),
'color' => array(
'background' => null,
'corePalette' => null,
'coreGradients' => null,
'custom' => null,
'customDuotone' => null,
'customGradient' => null,
Expand Down
2 changes: 2 additions & 0 deletions lib/theme.json
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,8 @@
}
],
"custom": true,
"corePalette": true,
"coreGradients": true,
"customDuotone": true,
"customGradient": true,
"link": false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,11 @@ const PanelColorGradientSettingsMultipleSelect = ( props ) => {
const userColors = useSetting( 'color.palette.user' );
const themeColors = useSetting( 'color.palette.theme' );
const coreColors = useSetting( 'color.palette.core' );
const shouldDisplayCoreColors = useSetting( 'color.corePalette' );

colorGradientSettings.colors = useMemo( () => {
const result = [];
if ( coreColors && coreColors.length ) {
if ( shouldDisplayCoreColors && coreColors && coreColors.length ) {
result.push( {
name: __( 'Core' ),
colors: coreColors,
Expand All @@ -201,9 +203,14 @@ const PanelColorGradientSettingsMultipleSelect = ( props ) => {
const userGradients = useSetting( 'color.gradients.user' );
const themeGradients = useSetting( 'color.gradients.theme' );
const coreGradients = useSetting( 'color.gradients.core' );
const shouldDisplayCoreGradients = useSetting( 'color.coreGradients' );
colorGradientSettings.gradients = useMemo( () => {
const result = [];
if ( coreGradients && coreGradients.length ) {
if (
shouldDisplayCoreGradients &&
coreGradients &&
coreGradients.length
) {
result.push( {
name: __( 'Core' ),
gradients: coreGradients,
Expand Down
10 changes: 10 additions & 0 deletions schemas/json/theme.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,16 @@
"type": "boolean",
"default": true
},
"corePalette": {
"description": "Allow users to choose colors from the Core palette. \nGutenberg plugin required.",
"type": "boolean",
"default": true
},
"coreGradients": {
"description": "Allow users to choose colors from the Core gradients. \nGutenberg plugin required.",
"type": "boolean",
"default": true
},
"custom": {
"description": "Allow users to select custom colors.\nSince 5.8.",
"type": "boolean",
Expand Down