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

WIP: color modes docs #1186

Merged
merged 36 commits into from Mar 11, 2021
Merged

WIP: color modes docs #1186

merged 36 commits into from Mar 11, 2021

Conversation

BinaryMuse
Copy link
Contributor

@BinaryMuse BinaryMuse commented Oct 20, 2020

This PR is a WIP for improving the Primer CSS "Support -> Color system", "Support -> Variables", and "Utilities -> Colors" pages for a post-color-modes world.

Color scales

Now that most of the usable colors are represented by functional variables, there's less of a need to document the individual color scale values. However, I've included them just in case they're needed for some dotcom hacks.

These tables are automatically generated based on the values from Primer Primitives.

image

Functional variables

I had more trouble when starting to look into documenting the functional variables. There are a huge number of them, and arguably some of them probably shouldn't really be used by end-users of the system at all. For example, --color-calendar-graph-day-L2-bg serves a very specific purpose and that color shouldn't be used for any other components, even if the color matches, so does it need to be documented at all? Further, some of the values aren't colors at all, e.g. --color-btn-primary-shadow is 0 1px 0 rgba(27,31,35,0.1) (and, again, is for a specific component, so should it be documented at all?)

For this category of colors, I'm starting to lean toward hand-written documentation, detailing how to pick one of the reusable functional colors (e.g. how do I pick between text-primary vs text-secondary vs text-tertiary) rather than just generating a huge list of all the functional colors.

Variables

For the "Support -> Variables" page, I think we can keep this the way it is, just with the Sass color variables removed (but leave the other Sass variables, like $spacer-* etc).

@vercel
Copy link

vercel bot commented Oct 20, 2020

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/primer/primer-css/rdjeaawx3
✅ Preview: https://primer-css-git-mkt-color-modes-docs.primer.now.sh

@BinaryMuse
Copy link
Contributor Author

BinaryMuse commented Oct 21, 2020

/cc folks who might have opinions on this: @colebemis @emplums @auareyou @broccolini @simurai

</PaletteCell>
{colorModes.map(mode => (
<PaletteCell as="th" {...colorProps} key={mode}>
{capitalize(mode)} Mode
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note to self: move capitalize to CSS

Copy link
Contributor

Choose a reason for hiding this comment

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

Would this make state-hoverPrimaryBg into state-hover-primary-bg? That would be nice for copy&pasta.

Copy link
Contributor

Choose a reason for hiding this comment

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

I used the kebabCase function from lodash to convert hoverPrimerBg to hover-primer-bg in https://primer.style/primitives

@simurai
Copy link
Contributor

simurai commented Oct 22, 2020

I had more trouble when starting to look into documenting the functional variables. There are a huge number of them, and arguably some of them probably shouldn't really be used by end-users of the system at all.

Hmm.. yeah, I have the same concerns. I think initially we should encourage people to only use the "global" variables. The rest is kinda "private".

I also wonder... now that all the variables got moved to primer/primitives, do we even wanna show them in the Primer CSS docs? Or how should it be different to https://primer.style/primitives/? I guess we should have the utilities still in Primer CSS since technically still lives in primer/css.

Otherwise the docs itself look nice. ✨

@BinaryMuse
Copy link
Contributor Author

I think initially we should encourage people to only use the "global" variables. The rest is kinda "private".

I agree. I'm trying this out now, will see how it goes. I want to find a good balance between having docs that are useful and well presented as well as docs that don't go out of date when we change Primer Primitives 🙈

I also wonder... now that all the variables got moved to primer/primitives, do we even wanna show them in the Primer CSS docs? Or how should it be different to https://primer.style/primitives/?

Good question. /cc @colebemis for thoughts. Is the plan to add the Primer Primitives docs to the primer.style homepage, or was this a temporary or experimental thing?

@colebemis
Copy link
Contributor

Is the plan to add the Primer Primitives docs to the primer.style homepage, or was this a temporary or experimental thing?

I created primer.style/primitives as a temporary way to reference color variables. But I think it could make sense to build it out into something more permanent. Then we can link to it from the Primer CSS docs.

@vercel vercel bot temporarily deployed to Preview October 23, 2020 03:31 Inactive
@auareyou
Copy link
Contributor

I think initially we should encourage people to only use the "global" variables. The rest is kinda "private".

I agree. I'm trying this out now, will see how it goes. I want to find a good balance between having docs that are useful and well presented as well as docs that don't go out of date when we change Primer Primitives 🙈

Agree as well! What I was hoping for is to write a guide on how to use the global variables and use for our color docs as well. I have a lot of hoarded notes I can provide to either help with this or help wrtiing it .

@BinaryMuse
Copy link
Contributor Author

I have a lot of hoarded notes I can provide to either help with this or help wrtiing it .

Thanks, @auareyou, I'd love any notes you've collected! I'll be putting the finishing touches on a first go next week.

@vercel vercel bot temporarily deployed to Preview October 23, 2020 17:18 Inactive
@vercel vercel bot temporarily deployed to Preview October 26, 2020 18:15 Inactive
@vercel vercel bot temporarily deployed to Preview October 26, 2020 21:21 Inactive
@vercel vercel bot temporarily deployed to Preview November 17, 2020 01:01 Inactive
@vercel vercel bot temporarily deployed to Preview November 19, 2020 00:27 Inactive
@vercel vercel bot temporarily deployed to Preview December 14, 2020 19:03 Inactive
@vercel vercel bot temporarily deployed to Preview December 15, 2020 20:09 Inactive
@vercel vercel bot temporarily deployed to Preview February 5, 2021 16:01 Inactive
@vercel vercel bot temporarily deployed to Preview February 5, 2021 16:15 Inactive
Base automatically changed from mkt/color-modes-whee to release-16.0.0 March 10, 2021 13:16
@simurai simurai mentioned this pull request Mar 11, 2021
16 tasks
@simurai simurai marked this pull request as ready for review March 11, 2021 00:53
@simurai simurai merged commit 27555ac into release-16.0.0 Mar 11, 2021
@simurai simurai deleted the mkt/color-modes-docs branch March 11, 2021 00:53
@@ -0,0 +1,262 @@
---
title: Primer v16 Migration Guide
Copy link
Member

Choose a reason for hiding this comment

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

What's the URL for this file? I still find myself needing to refer to the new names like color-text-secondary instead of text-gray, and the old URL I was using, https://github.com/primer/css/blob/mkt/color-modes-docs/docs/content/support/v16-migration.mdx#utility-classes, now 404s. 🙇‍♀️

Copy link
Contributor

@simurai simurai Mar 23, 2021

Choose a reason for hiding this comment

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

@cheshire137 Ahh.. sorry. Updated the links. Eventually it will show up in https://primer.style/css, but for now you can see it with this preview URL: https://primer-css-git-release-1600-primer.vercel.app/css/support/v16-migration

Copy link
Member

Choose a reason for hiding this comment

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

Thank you!

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.

None yet

7 participants