Dark/light theme determination in Cover block omits gradient #28117
Labels
[Block] Cover
Affects the Cover Block - used to display content laid over a background image
[Type] Enhancement
A suggestion for improvement.
When using a gradient as the overlay color in the Cover block the theme determination does not factor in the gradient colors. Without an image, the outcome is always light-themed. With an image, if the overlay opacity is > 50 the outcome is always dark-themed. Here are example cases where this makes for poor contrast:
The
useCoverIsDark
hook is what determines which theme to use. I'm assuming that gradient support was added on at some point and the hook was not updated to support it. Probably a fairly challenging thing to get right. Just averaging the gradient stop colors may work well enough if they are equidistant but what to do in case they are not?To reproduce
Steps to reproduce the behavior:
The text was updated successfully, but these errors were encountered: