Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add utility classes for all the colors #752

Closed
shawnbot opened this issue Apr 9, 2019 · 1 comment
Closed

Add utility classes for all the colors #752

shawnbot opened this issue Apr 9, 2019 · 1 comment

Comments

@shawnbot
Copy link
Contributor

shawnbot commented Apr 9, 2019

Right now we've got a smattering of colors available in cryptically named utility classes like text-gray-dark ($gray-900) and bg-green-light ($green-100). We'd like to make the full color palette available as foreground and background utilities, i.e. as .text-gray-9 and .bg-green-1.

We're aiming for parity with Primer Components, which expose "theme-aware" props for foreground and background:

  • color="blue.4" is equivalent to color={theme.colors.blue[4]}
  • bg="gray.1" is equivalent to bg={theme.colors.gray[1]}

and in which our theme's colors object contains arrays of values for each hue. The $hue-X00 naming scheme is (in @broccolini's words) an artifact of a previous color scheme, so we'd like to eventually — and in a semver-friendly way — rename or alias these to $hue-X so that they match the utility class names.

In other words, something like:

// in support/variables/color-system.scss
$gray-000: $gray-0;
$gray-100: $gray-1;
// ...
$gray-900: $gray-9;

// in utilities/colors.scss
.bg-gray-0 { background-color: $gray-0 !important; }
.bg-gray-light,
.bg-gray-1 { background-color: $gray-1 !important; }
// ...
.bg-gray-dark,
.bg-gray-9 { background-color: $gray-9 !important; }

We'll probably still suggest the use of -light and -dark utilities for general use, and to reduce the confusion around which shade of a given hue can/should be used in most contexts. But this change will make it easier to track down which shade those utilities use, and offer a broader palette on which new components can be built in HTML alone.

@simurai
Copy link
Contributor

simurai commented May 10, 2019

Shipped in #760

@simurai simurai closed this as completed May 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants