Skip to content

settings.color.duotone = null does not validate against theme.json schema #40383

@mrwweb

Description

@mrwweb

Description

After reviewing a number of issues including #31764, #33295, #35931, and #38299, I believe that the following two theme.json values are required to fully disable the custom duotone feature:

  1. settings.color.duotone: null removes the SVG filters output in the body field. Setting this property to an empty array ([]) does not work.
  2. settings.color.customDuotone: removes the UI toolbar control in combination with the first change

However, when I try to validate my theme.json, there is an error for settings.color.duotone: null:

None is not a type of 'array'

Prior to WordPress 5.9.3, the null value also seemed to cause a PHP error, but I believe that has been resolved.

So first: Is this the correct way to fully disable duotone support with theme.json.

If so:

  1. The schema needs to be updated to allow null for settings.color.duotone -OR- using [] as the value for that setting should prevent the SVG filters from being output
  2. The official way to remove duotone should be documented

Step-by-step reproduction instructions

Validate the following theme.json file:

{
	"$schema": "https://schemas.wp.org/trunk/theme.json",
	"version": 2,
	"settings": {
		"color": {
			"duotone": null,
			"customDuotone": false
		}
	}
}

Screenshots, screen recording, code snippet

No response

Environment info

WordPress 5.9.3

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

No

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions