Link Color: substitute the CSS Custom Property by the mechanism used in layout and duotone #31488
Labels
CSS Styling
Related to editor and front end styles, CSS-specific issues.
[Feature] Themes
Questions or issues with incorporating or styling blocks in a theme.
Global Styles
Anything related to the broader Global Styles efforts, including Styles Engine and theme.json
The link color is an experimental feature a theme can opt-in. At the user level, it works by attaching
--wp--style--color--link: <user selected value>
to the block wrapper. At the global level, it works by outputting a new ruleset such asblock selector { --wp--style--color--link: <theme_or_user_value>}
. They work because the framework also outputs this rule<selector for links> { color: var(--wp--style--color--link, <fallback value>}
, which we enqueue when the theme has support for theme.json or has opted-in for link color.The link color is experimental for a few reasons, such as that it doesn't work for roles without
unfiltered_html
capabilities #25151 and that we were exploring how to target the inner contents of a block. The current iteration for inner block markup focus on two efforts: allowing blocks to serialize themselves the style properties to parts of its markup they want #28913 and the introduction of elements as a way to target structured inner elements via theme.json #29891 Additionally, we've recently introduced a mechanism to render some styles in the server and collocate<style>
tags with the block that uses them, see layout #29335 and duotone #26752With all this new data, we have an opportunity to improve and simplify how the link color works by making it work like layout and duotone and tapping into the elements mechanism.
The text was updated successfully, but these errors were encountered: