You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Best practices are only community conventions meant to fill in opinions when you have none. Disregard any information in here if it doesn’t work with your organization, or if there is a conflict between this information and your configuration.
9
9
10
+
## Aliasing
11
+
12
+
Use [aliases](/docs/tokens#aliasing)! They’re free and can help make your design system easier-to-use. Here are just a few ways you can use aliases:
13
+
14
+
- Common spelling differences, e.g. `color.gray` → `color.grey` (fun fact: CSS supports both spellings!)
15
+
- Useful shortcuts, e.g. `color.white` → `color.gray.100`
16
+
- Semantic colors e.g. `color.ui.action` → `color.blue`, `color.ui.error` → `color.red`, etc.
17
+
10
18
## Casing
11
19
12
20
Prefer **camelCased** properties when possible:
@@ -29,3 +37,31 @@ This will result in more predictable naming, and in many languages is simpler to
29
37
- tokens.typography['base-heading'].$value;
30
38
+ tokens.typography.baseHeading.$value;
31
39
```
40
+
41
+
## Logical color numbering
42
+
43
+
Many design systems use [color ramps](https://ferdychristant.com/color-for-the-color-challenged-884c7aa04a56) which typically use numbers for greater flexiblity than relative terms like _dark_, _darker_, etc. But if possible, make your numbering follow some **logical** reasoning.
44
+
45
+
For example, since Cobalt supports [OKLCH](https://evilmartians.com/chronicles/oklch-in-css-why-quit-rgb-hsl), you could use **perceived lightness** as the number where `color.blue.60` is 60% light, `color.blue.70` is 70% light, and so on:
Copy file name to clipboardexpand all lines: docs/src/pages/docs/tokens/index.astro
+2-2
Original file line number
Diff line number
Diff line change
@@ -698,7 +698,7 @@ const tokenDef = {
698
698
}`}
699
699
/>
700
700
701
-
<h2>Custom types</h2>
701
+
<h2id="custom-types">Custom types</h2>
702
702
703
703
<p>
704
704
Any other <code>$type</code> will be treated as a custom type. <code>$value</code> may have any shape desired. But note that custom types will likely break existing plugins unless you configure them (the CSS and Sass plugins have a <b
@@ -708,7 +708,7 @@ const tokenDef = {
708
708
709
709
<p><i>Should a type be added?<ahref="https://github.com/design-tokens/community-group">Suggest it be added!</a></i></p>
710
710
711
-
<h2>Aliasing</h2>
711
+
<h2id="aliasing">Aliasing</h2>
712
712
713
713
<p>
714
714
Types can be aliased <ahref="https://design-tokens.github.io/community-group/format/#aliases-references"target="_blank">as defined in the Design Tokens spec</a> by using dot-delimited path syntax, wrapped in curly braces (e.g., <code
0 commit comments