-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Description
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. #34667 (comment)
I lean towards
styles.filters.duotoneconceptually even if we were to havesettings.color.palette.duotonefor 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.duotonethat enables/disables the feature. It was previously handled bysupports.color.__experimentalDuotonebeing set totrueto use the default block selector orsupports.__experimentalSelectoror set to a string if a custom selector was needed. - Add
selectors.filter.duotonethat specifies the custom selector previously nested undersupports.color.__experimentalDuotonefor 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.