Cover block: Text color #33723
Labels
[Block] Cover
Affects the Cover Block - used to display content laid over a background image
[Feature] Themes
Questions or issues with incorporating or styling blocks in a theme.
[Type] Enhancement
A suggestion for improvement.
What problem does this address?
It is currently difficult to set a text color for Cover block inner elements easily in one place. Currently if Cover block content contains of Heading, Paragraph and List, for example, I have to set text color for each one of these.
Instead, the preferable solution would be to set text color on the Cover block itself, so the inner elements can inherit the color.
What is your proposed solution?
In my theme, I've tried to enable the text color control for Cover block using a JavaScript code in a file enqueued via
enqueue_block_editor_assets
action with PHP.Here is the actual JavaScript code portion dealing with the issue:
This indeed produces a working text color control, which resolves my issue, actually.
Unfortunately, the code above breaks the custom overlay color functionality. When I use the code above, I can only choose the overlay color from predefined palette (which works well as the palette color class is applied on the Cover container) but I can no longer set a custom overlay color (which does not produce
background-color:...
inline style on the Cover container anymore).I understand that overlay color is actually set as a background color on Cover container. But I fail to understand why enabling text color breaks (part of) this functionality.
Could anyone enlighten me please? Is there any way of implementing this currently via WordPress theme?
Could text color control be added to Cover block?
Thanks for any help!
The text was updated successfully, but these errors were encountered: