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

Allow to keep some tokens in output as references #1100

Merged
merged 2 commits into from
Dec 17, 2024

Conversation

lukasoppermann
Copy link
Contributor

@lukasoppermann lukasoppermann commented Dec 5, 2024

Summary

This PR makes changes to the way references are used in the css platform. Now, all referenced tokens that are in the output will be used as references, while base tokens that are not in the output will be converted to hex values.

Impact

This work enables a lot of use cases related to customization including.
In short, this update allows us to change design tokens (e.g. colors, text sizes, contrast, etc.) in the browser (e.g. user settings) that will propagate through all of github.

For example:

  • A user could define the contrast they want for border colors in the settings
  • A user could choose a specific color for e.g. success states

@lukasoppermann lukasoppermann requested review from a team as code owners December 5, 2024 08:36
Copy link

changeset-bot bot commented Dec 5, 2024

🦋 Changeset detected

Latest commit: 31aed64

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@primer/primitives Minor

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

Copy link
Contributor

github-actions bot commented Dec 5, 2024

Design Token Diff (CSS)

The message is too long to be displayed here. For more details, please check the job summary.

@lukasoppermann
Copy link
Contributor Author

lukasoppermann commented Dec 6, 2024

Current bug:

Style dictionaries outputReferencesTransformed function does not work with object tokens (composite tokens) as far as I can see.

The output for shadows now has a color value that is: {color.token.reference} [2 digits of hex8 for alpha value] since this this not a valid color, the shadow is broken:

    --shadow-floating-xlarge: 0px 0px 0px 1px #d1d9e0, 
       0px 56px 112px 0px var(--base-color-neutral-12) 52; /* <- this 52 is the problem */

I am currently in contact with the folks from Style Dictionary to figure this out.

@lukasoppermann

This comment was marked as resolved.

Copy link
Contributor

Design Token Diff (StyleLint)

The message is too long to be displayed here. For more details, please check the job summary.

@github-actions github-actions bot temporarily deployed to Preview (Storybook) December 17, 2024 09:33 Inactive
@lukasoppermann lukasoppermann marked this pull request as ready for review December 17, 2024 11:59
@lukasoppermann lukasoppermann merged commit b995538 into main Dec 17, 2024
27 checks passed
@lukasoppermann lukasoppermann deleted the output-references branch December 17, 2024 11:59
@primer primer bot mentioned this pull request Dec 17, 2024
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.

2 participants