Uswds: [Colors]: Add helper classes for text and background colors

Created on 18 Apr 2017  路  5Comments  路  Source: uswds/uswds

Description

It would be useful to have all the standards colors accessible for text and background colors as classes. It would make prototyping layouts and components much quicker too.

You could potentially consider ensuring the background colors use accessible text colors, but not sure if that's a must have since multiple colors could be accessible for a single background color.

documentation enhancement

All 5 comments

I'm queueing this up for v1.2. Thanks, @maya!

This would also be a good chance to do #960.

I should be able to share more soon 馃槃 but wanted to jump in and +1 this. We've created utility classes for WDS background and text colors in our design system for HealthCare.gov and they've been handy for prototyping and beyond. Once we make the repo public, I'll be sure to ping y'all.

We could pretty easily do this with a Sass map and an @each loop:

$colors: (
  primary: $color-primary,
  primary-alt: $color-primary-alt
);

@each $name, $color in $colors {
  .usa-fg-#{$name} { color: $color; }
  .usa-bg-#{$name} { background-color: $color; }
}
Was this page helpful?
0 / 5 - 0 ratings

Related issues

DruidSmith picture DruidSmith  路  5Comments

shawnbot picture shawnbot  路  7Comments

ericadeahl picture ericadeahl  路  4Comments

jlarmstrongiv picture jlarmstrongiv  路  4Comments

zestyping picture zestyping  路  3Comments