Duotone filter support has been added in block.json under the supports.color.__experimentalDuotone since it was introduced. It was marked as experimental because it required a special selector different from the supports.color.__experimentalSelector.
With the selectors API stabilized in #46496, the duotone supports can now utilize it.
Duotone filters were initially added under color support when they were only part of block supports and theme.json presets. Then, when global styles support was added, that functionality was nested under filter instead. https://github.com/WordPress/gutenberg/pull/34667#issuecomment-929384846
I lean towards styles.filters.duotone conceptually even if we were to have settings.color.palette.duotone for a palette definition it’s conceivable duotone palettes could be used for more than duotone filters either as gradient backgrounds or masks or something else
The new stabilized duotone block supports should be nested under filter following that reasoning.
Two changes to block.json (including the schema) are required:
Add a boolean block support under supports.filter.duotone that enables/disables the feature. It was previously handled by supports.color.__experimentalDuotone being set to true to use the default block selector or supports.__experimentalSelector or set to a string if a custom selector was needed.
Add selectors.filter.duotone that specifies the custom selector previously nested under supports.color.__experimentalDuotone for the case mentioned in 1.
Duotone uses the block.json metadata directly, unlike some of the other supports. And there were special cases added for __experimentalDuotone throughout the code. So anywhere that was using that should provide an upgrade path by providing a migration or continuing to support it if a migration isn't possible.
Duotone filter support has been added in block.json under the
supports.color.__experimentalDuotone
since it was introduced. It was marked as experimental because it required a special selector different from thesupports.color.__experimentalSelector
.With the selectors API stabilized in #46496, the duotone supports can now utilize it.
Duotone filters were initially added under
color
support when they were only part of block supports and theme.json presets. Then, when global styles support was added, that functionality was nested underfilter
instead. https://github.com/WordPress/gutenberg/pull/34667#issuecomment-929384846The new stabilized duotone block supports should be nested under
filter
following that reasoning.Two changes to block.json (including the schema) are required:
supports.filter.duotone
that enables/disables the feature. It was previously handled bysupports.color.__experimentalDuotone
being set totrue
to use the default block selector orsupports.__experimentalSelector
or set to a string if a custom selector was needed.selectors.filter.duotone
that specifies the custom selector previously nested undersupports.color.__experimentalDuotone
for the case mentioned in 1.Duotone uses the block.json metadata directly, unlike some of the other supports. And there were special cases added for
__experimentalDuotone
throughout the code. So anywhere that was using that should provide an upgrade path by providing a migration or continuing to support it if a migration isn't possible.