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

Migrate to Radix color table and "2D color coordinates" #3133

Open
abey79 opened this issue Aug 29, 2023 · 3 comments
Open

Migrate to Radix color table and "2D color coordinates" #3133

abey79 opened this issue Aug 29, 2023 · 3 comments
Labels
🧑‍🎨 Design Requires UX/UI designer input ui concerns graphical user interface

Comments

@abey79
Copy link
Member

abey79 commented Aug 29, 2023

These are some notes following a discussion with @martenbjork on how to evolve the current design token system in the short term, such as to address some of its shortcoming and go in the direction of emilk/egui#3284.

Goals

  • start using the Radix color tables and use taint/index color coordinates
  • make it much easier to iterate on alias (mapping from "type of use in the UI" -> "color coordinate"), while retaining a single source of truth (so both rerun, Figma, and @martenbjork's React prototype use the same mappings)

Solutions

  1. Create a public, single-file repository containing a dead-simple JSON containing the aliases.
    The idea is to minimise friction when new alias must be created by rerun dev (use-case example: subdued container color in the blueprint tree UI, etc.) during dev iterations. Using a file on rerun-io/landing is not possible since that repo is private (can't easy pull the json where it's needed).
  2. Hard-code the radix color table in Rerun.
  3. Use that file instead of the current design-token.json file. Create/update script to automate pulling the file from the reference repo.
  4. Take similar steps on the side of Figma and @martenbjork's proto.
  5. Progressively update the code-base use the new system instead of ugly hacks (like setting 50% gamma, etc.)
@abey79 abey79 added the ui concerns graphical user interface label Aug 29, 2023
@martenbjork
Copy link
Contributor

Thanks for taking notes!

Hard-code the radix color table in Rerun

I think it might be worth having this live in the tokens file for 3 reasons:

  1. Radix may update their values in the future (they frequently tweak them)
  2. Other systems (Figma import, website) need the values as well. It's good if they can do it without having to install radix or copy paste and hard code radix values.
  3. We want to have non-radix values in there as well, for typography, shadows etc.

Based on this, I suggest this JSON format:

{
  // We add radix colors and other global tokens here
  "colors": {
    "slate": {
      "1": {
        "$type": "color",
        "$description": "",
        "$value": {
          "hex": "#000000"
        }
      },
      "2": {
        "$type": "color",
        "$description": "",
        "$value": {
          "hex": "#000000"
        }
      },
      "3": {
        "$type": "color",
        "$description": "",
        "$value": {
          "hex": "#000000"
        }
      }
    }
  },

  // This is where we add our custom values
  "surface": {
    "default": {
      "$type": "color",
      "$description": "Default color in...",
      "$value": "{color.slate.2}"
    }
  },
  "interactive": {
    "default": {
      "$type": "color",
      "$description": "Default color in...",
      "$value": "{color.slate.4}"
    },
    "hover": {
      "$type": "color",
      "$description": "Default color in...",
      "$value": "{color.slate.5}"
    },
    "pressed": {
      "$type": "color",
      "$description": "Default color in...",
      "$value": "{color.slate.3}"
    }
  }
}

@martenbjork
Copy link
Contributor

Related reading:

@Wumpf Wumpf added the 🧑‍🎨 Design Requires UX/UI designer input label Sep 18, 2024
@frankvgompel
Copy link

In case you hadn't noticed, I published an egui toolkit based on the Radix system and APCA luminosity contrast and without .json files. Its purpose is to give food for thought about colour styling.

abey79 added a commit that referenced this issue Dec 6, 2024
### Related

* Part of/related to #3133
* Part of #3058

### What

This PR refactors the design token as follows:

- All colors from `design_tokens.json` are now loaded in a big table at
startup.
- Colors are now referred to using the new the `ColorToken`, which is
basically an index into this table.
- Removed all of the color aliases stuff. This was only partially used
and very cumbersome to update. The `design_token.rs` file is the _de
facto_ source of truth of semantic aliasing for colors.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🧑‍🎨 Design Requires UX/UI designer input ui concerns graphical user interface
Projects
None yet
Development

No branches or pull requests

4 participants