Allow use of ref
in theme.json settings
, as is possible with styles
#57286
Labels
[Feature] Themes
Questions or issues with incorporating or styling blocks in a theme.
[Package] Style Engine
/packages/style-engine
[Type] Enhancement
A suggestion for improvement.
What problem does this address?
I use theme.json
settings
>color
>palette
to set a "global" list of allowed colors to use throughout the whole block editor, then I restrict certain blocks to certain colors by providing a refined list of colors insettings
>blocks
>{block_name}
>color
>palette
; however, it seems I have to manually re-define color objects (i.e.{ "slug": "...", "name": "...", "color": "..." }
) when defining a block-specific palette, and can't reference colors from my global palette in a dynamic way. I end up having to copy/paste the color definitions from my global palette into my block-specific palettes multiple times, resulting in tons of duplicate code that creates maintenance hell should I choose to change colors later. Example:What is your proposed solution?
In my troubleshooting/research I came across the introduction of the
ref
mechanism in theme.json'sstyles
, where you can dynamically reference other values in thestyles
object/tree. This is exactly the solution I want, but for theme.jsonsettings
. I would have expectedref
to be use-able throughout the whole theme.json tree, not just understyles
.Here's what I'd like:
Please let me know if I'm missing an existing capability for achieving this!
The text was updated successfully, but these errors were encountered: