Skip to content

Link Color: substitute the CSS Custom Property by the mechanism used in layout and duotone #31488

Closed

Description

@oandregal

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 as block 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 #26752

With 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.

Activity

  1. added
    [Feature] Themes
    CSS Styling
    Global Styles
    on May 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

CSS StylingGlobal Styles[Feature] Themes

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions