-
Notifications
You must be signed in to change notification settings - Fork 535
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 color blind themes #1474
Add color blind themes #1474
Conversation
🦋 Changeset detectedLatest commit: 56ed28a The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
size-limit report 📦
|
src/theme-preval.js
Outdated
const colorSchemes = Object.entries(primitives.colors) | ||
.map(([name, variables]) => { | ||
const {colors, shadows} = partitionColors(variables) | ||
return [name, {colors: omitScale(colors), shadows: omitScale(shadows)}] | ||
}) | ||
.reduce((acc, [name, variables]) => { | ||
acc[name] = variables | ||
return acc | ||
}, {}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I refactored this part of the code to get all color schemes from Primer Primitives instead of hard-coding references to them. This means that when future color schemes are published in Primer Primitives, we only need to bump the Primer Primitives version number in Primer React to make the color schemes available to Primer React consumers.
src/theme-preval.js
Outdated
*/ | ||
const darkHighContrastShadows = omitScale(darkHighContrast.shadows) | ||
const colorSchemes = Object.entries(primitives.colors) | ||
.map(([name, variables]) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Non-blocking: you could collapse this map into the reduce below, if you think it'd be more readable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup. Good call. I'll do that
…into color-blind-themes
Adds color blind color schemes published in v4.8.0 of Primer Primitives.
Try it out in storybook: https://primer-components-4g2oegw1w-primer.vercel.app/react/storybook?path=/story/composite-components-button--primary-button&globals=dayScheme:light_protanopia
Part of https://github.com/github/design-infrastructure/issues/1911