Skip to content

Conversation

@danielmatthew
Copy link
Contributor

@danielmatthew danielmatthew commented Aug 8, 2020

This PR uses a map of the colour variables to create utility classes for color, background-color and fill.

A screenshot of the generated documentation, showing the new utility classes in effect

Closes #1046

);

@each $name, $var in $text-colors {
.u-text-#{$name} {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does KSS work inside a loop?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A: Not quite… I wondered whether the variables would be processed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I went down a rabbit hole about this. It turns out Sass isn't built to dynamically generate comments, unfortunately.

}

.u-fill-#{$name} {
fill: $var;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are your thoughts on using !important on these utilities? I popped a fill class on the logo, but because they're imported early on, it was superseded by c-logo__icon.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer to keep it off. I don't mind occasionally using color declarations outside of scope the utility classes, so long as there's a specific design need.

Copy link
Member

@ericwbailey ericwbailey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see you found the very half-baked styleguide 😅

);

@each $name, $var in $text-colors {
.u-text-#{$name} {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I went down a rabbit hole about this. It turns out Sass isn't built to dynamically generate comments, unfortunately.

}

.u-fill-#{$name} {
fill: $var;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer to keep it off. I don't mind occasionally using color declarations outside of scope the utility classes, so long as there's a specific design need.

@danielmatthew
Copy link
Contributor Author

@ericwbailey Are there any further changes I can make to see this over the line? I'm not sure whether the original scope covered implementing the classes as well, but I am happy to do that – whether in this PR or a new branch.

@ericwbailey ericwbailey merged commit 2889d42 into a11yproject:main Aug 16, 2020
@ericwbailey
Copy link
Member

@danielmatthew Ah shoot, sorry about that. I've had a pretty demanding client so my attention has been all over the place.

No changes needed, this is a great addition! Thank you again for your help.

@danielmatthew danielmatthew deleted the 1046-colour-util-classes branch August 16, 2020 09:42
@danielmatthew
Copy link
Contributor Author

@ericwbailey No worries – I understand. Happy to look out for future 'help wanteds' 🥳

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create color utility classes

2 participants