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

Clearer naming and separation of non-semantic design tokens #2886

Open
unekinn opened this issue Dec 11, 2024 · 1 comment
Open

Clearer naming and separation of non-semantic design tokens #2886

unekinn opened this issue Dec 11, 2024 · 1 comment
Labels
cli @digdir/designsystemet 👨‍💻developer experience 🕵️ investigate Needs investigation

Comments

@unekinn
Copy link
Contributor

unekinn commented Dec 11, 2024

The current naming convention for design tokens makes it hard to see at a glance if a token is a primitive token or a theme-level token (both of which should never be referenced directly from Figma designs or code), or if it is a semantic token.

Suggestion

This makes the references and variables easy to scan: if they begin with primitive or theme, they are not to be used directly.

Examples

primitives/modes/color-scheme/dark/global.json

Before:

{
  "global": {
    "blue": {
      "1": {

After:

{
  "primitive": {
    "color": {
      "global": {
        "blue": {
          "1": {

primitives/modes/color-scheme/dark/theme.json

Before:

{
  "theme": {
    "accent": {
      "1": {

After (renamed to primitives/modes/color-scheme/dark/digdir.json):

{
  "primitive": {
    "color": {
      "digdir": {
        "accent": {
          "1": {

themes/theme.json

Before:

{
  "color": {
    "accent": {
      "1": {

After (renamed to themes/digdir.json):

{
  "theme":
    "color": {
      "accent": {
        "1": {

Changes to references

  • global.blue.1primitive.color.global.blue.1
  • theme.accent.1primitive.color.digdir.accent.1
  • color.accent.1theme.color.accent.1
  • color.accent.background-default unchanged as it is a semantic token
@mimarz mimarz added this to the V1 - Helhetlig tematisering milestone Dec 11, 2024
@mimarz mimarz added the cli @digdir/designsystemet label Dec 11, 2024
@mimarz
Copy link
Collaborator

mimarz commented Dec 11, 2024

We'll have to look at this after #2674

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli @digdir/designsystemet 👨‍💻developer experience 🕵️ investigate Needs investigation
Projects
Status: 🔵 Inbox
Development

No branches or pull requests

2 participants