A design-focused entry in TopGit's GitHub warehouse: primer/primitives, 417 stars, UI / UX, TypeScript. Color, typography, and spacing primitives in json.
Snapshot summary built from the project's own GitHub metadata — there's no written TopGit review yet. The page will update automatically when a full review is published.
WHY NO REVIEW YET
TopGit writes full reviews for the most-starred, most-requested repositories. This page is a snapshot until then — see the READ ME tab for the original README in full.
Note: Motion CSS imports are required for components with animations, such as Spinner from @primer/react. If you're experiencing issues with animated components appearing static, ensure you've imported the motion CSS files.
Note: Spacing tokens provide a unified semantic scale for gap, padding, and margin. Import functional/spacing/space.css to use --space-* tokens in your components.
Design token data
Design token data is stored in the src/tokens directory. These tokens are compiled with style dictionary in scripts/buildTokens.ts.
To make working with tokens easier, we added some additional functionality on top of what style dictionary comes with:
Extending and Overwriting
We have two main color modes: light and dark. Additionally we have specific accessibility modes based on those, such as light high contrast.
We added a way to create a mode by only including the changes from the main mode. We call this overrides.
Overrides are created in src/tokens/functional/color/[light|dark]/overrides/ and have to be added to themes.config.ts to work.
In the individual files, e.g. light.high-contrast.json5 you can now add tokens in the same structure as in any main file, e.g. primitives-light.json5 to replace them.
Transforming Colors with Alpha and Mix
Alpha
You can create color tokens that inherit a color but have a different alpha value by adding the alpha property.
Note: The original alpha value will be replaced by your value. If you add alpha: 0.4 to a color, it doesn't matter if the color you reference has no alpha or alpha: 0.7, the new token will always have newly the defined value of alpha: 0.4.
{
muted: {
$value: '{base.color.blue.3}',
alpha: 0.4, // the opacity value of the color === 40% opaque
$type: 'color',
},
}
Extensions property
According to the w3c design token specs, the $extensions property is used for additional meta data.
For our Figma export we use the following meta data:
collection the collection that the token is added to within Figma
mode the mode that the token is added to within the collection in Figma
scopes the scopes that are assigned to the token in Figma, the actual Figma compatible scopes are retrieved from an object in the figmaAttributes transformer
Token names have to be in camelCase or kebab-case and may only include letters, numbers and -. This is enforced by the token validation (npm run lint:tokens).
The only exception is the @-hack. This is used when you want to have a default value and sub-values, e.g. bgColor.accent and bgColor.accent.muted.
In this case you can create the following structure. The @ will be removed from the name and act as the default value.
The most recent commit recorded on primer/primitives was 13 days ago, based on the GitHub push timestamp. The repository has 67 forks — one of the better signals of community interest.
How does primer/primitives compare to other UI / UX projects?
primer/primitives is tracked by TopGit in the UI / UX category, with 417 GitHub stars and written in TypeScript. Browse the UI / UX topic page on TopGit to compare it against similar projects by stars and activity.
How many stars does primer/primitives have?
primer/primitives has 417 GitHub stars — refresh the page for the live number, or check github.com/primer/primitives. TopGit mirrors GitHub's count but does not claim minute-by-minute accuracy.
What is primer/primitives?
primer/primitives (primer/primitives) is a TypeScript project on GitHub. From the project's own README: Color, typography, and spacing primitives in json.
What language is primer/primitives written in?
primer/primitives is written primarily in TypeScript. GitHub's language field is based on the largest share of bytes in the default branch.
What topics is primer/primitives associated with?
GitHub's repository topics for primer/primitives: "design-system", "design-tokens", "style-dictionary". TopGit's editorial category is UI / UX.
Why is primer/primitives categorized under UI / UX?
TopGit places primer/primitives in the UI / UX category based on its GitHub topics and description (tagged: "design-system", "design-tokens", "style-dictionary"). Categories are assigned from real repository metadata, not editorial guesswork.
Read full README in the tab above.
Want a second opinion on primitives?
Ask an AI that can read this page — one click and you get its take on primitives.