Background

The Olivero theme utilizes CSS variables in a very basic fashion. We declare colors like --color--primary-30, --color--primary-40, --color--primary-50, --color--primary-60,
--color--gray-5, --color--gray-10, --color--gray-20, --color--gray-45, --color--gray-60, etc.

We then utilize these variables directly within the component styles like

.breadcrumb__link {
  color: var(--color--primary-40);
}

Task

This task is to create an abstraction layer between the color custom properties and the component's CSS rules.

So, in the case above, we'd define a new variable scoped to :root something like --color-text-primary-medium and set that to var(--color--primary-40)

Then within the component stylesheet, we'd set the rule to use the new --color-text-primary-medium property.

.breadcrumb__link {
  color: var(--color-text-primary-medium);
}

Benefits

Once we have this abstraction layer in place, and another similar layer with background colors, we'll be in a great position to better control accessibility, as well as implement dark modes, etc.

Notes

We're not updating the link hover states here. The link hover-state color does not meet the 4.5:1 WCAG 2.0 AA standard, and needs to be updated. This will occur in a followup issue.

Resources

A list of CSS color properties, selectors, and values is at https://docs.google.com/spreadsheets/d/19zkRfD4CogL8ZUbIirpHpAH2Xh9ma6Va...

Issue fork drupal-3284912

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mherchel created an issue. See original summary.

mherchel’s picture

Issue summary: View changes
mherchel’s picture

Assigned: Unassigned » mherchel

Assigning this to myself.

mherchel’s picture

Title: Refactor Olivero's CSS text colors to create new "text-color" custom properties » Abstract and refactor Olivero's text color styles with new "text-color" custom properties
mherchel’s picture

Issue summary: View changes

mherchel’s picture

Status: Active » Needs review
javi-er’s picture

This looks good to me, I reviewed the color replacements and they are fine, visually everything is looking good as well, I'm attaching some screenshots of my local.

javi-er’s picture

Status: Needs review » Reviewed & tested by the community
mherchel’s picture

Issue summary: View changes
lauriii’s picture

This one is ready to be committed once the situation with HEAD has been sorted out.

  • lauriii committed 1e49b40 on 10.0.x
    Issue #3284912 by mherchel, javi-er: Abstract and refactor Olivero's...

  • lauriii committed 5b89b53 on 10.1.x
    Issue #3284912 by mherchel, javi-er: Abstract and refactor Olivero's...
lauriii’s picture

Status: Reviewed & tested by the community » Fixed

Committed 5b89b53 and pushed to 10.1.x. Also cherry-picked to 10.0.x. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.