@fusion.dev/helix-docs 0.140.0 → 0.142.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/content/color.mdx +10 -5
- package/content/intent-reference.mdx +15 -6
- package/content/maps.mdx +3 -3
- package/content/metrics.mdx +226 -225
- package/content/surfaces-and-separation.mdx +1 -1
- package/content/theme-builder.mdx +5 -0
- package/content/theming.mdx +33 -4
- package/dist/sources.generated.js +293 -244
- package/package.json +9 -9
package/content/color.mdx
CHANGED
|
@@ -39,14 +39,18 @@ separation](./surfaces-and-separation).
|
|
|
39
39
|
Inks are the colors that go on grounds. The base ink is `foreground`.
|
|
40
40
|
|
|
41
41
|
- `foreground-muted` and `foreground-subtle` are for text that recedes.
|
|
42
|
-
-
|
|
42
|
+
- Text on a filled color takes the ink named for that fill:
|
|
43
|
+
- `foreground-on-primary` on `primary-surface`
|
|
44
|
+
- `foreground-on-accent` on `accent-surface`
|
|
45
|
+
- `foreground-on-status` on the four status fills
|
|
43
46
|
|
|
44
47
|
### Intent
|
|
45
48
|
|
|
46
49
|
Intent colors show what something means.
|
|
47
50
|
|
|
48
51
|
- `primary` and `accent` are for emphasis. Each has `-hover`, `-active`, and
|
|
49
|
-
`-subtle` variants.
|
|
52
|
+
`-subtle` variants. With no brand color set, both are ink: near-black in
|
|
53
|
+
light mode and near-white in dark mode.
|
|
50
54
|
- `info`, `success`, `warning`, and `danger` are for status. Each has a
|
|
51
55
|
`-surface` and a `-surface-hover` variant for the tinted box that holds the
|
|
52
56
|
message.
|
|
@@ -75,9 +79,10 @@ OKLCH lets the theme engine *solve* for a palette from your brand color. See
|
|
|
75
79
|
|
|
76
80
|
## How the engine meets contrast targets
|
|
77
81
|
|
|
78
|
-
The engine measures each ink against the ground it will be painted on.
|
|
79
|
-
|
|
80
|
-
the target.
|
|
82
|
+
The engine measures each ink against the ground it will be painted on. A brand
|
|
83
|
+
color that already meets the target there is used as it is. For any other color,
|
|
84
|
+
the engine searches for the lightness that meets the target. Every pair it
|
|
85
|
+
produces meets the target.
|
|
81
86
|
|
|
82
87
|
The engine can solve only the pairs it knows about, so we check two things:
|
|
83
88
|
|
|
@@ -18,16 +18,17 @@ const theme = engine.derive({ brand: '#2563eb' })
|
|
|
18
18
|
|
|
19
19
|
[Deriving a theme](./theming) shows how Node loads the engine.
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
`brand`
|
|
21
|
+
**Every input is optional.** With no `brand`, the theme is ink: the primary
|
|
22
|
+
color is near-black in light mode and near-white in dark mode. Every other field
|
|
23
|
+
has a default, computed from `brand` or from the Helix design language, so an
|
|
24
|
+
empty intent, `{}`, is a valid theme.
|
|
24
25
|
|
|
25
26
|
## Color
|
|
26
27
|
|
|
27
28
|
| Field | What it controls |
|
|
28
29
|
|---|---|
|
|
29
|
-
| `brand` | Your main brand color.
|
|
30
|
-
| `accent` | The second emphasis color. Defaults to the brand color. `{ from: 'brand', rotate: 180 }` gives the complementary color |
|
|
30
|
+
| `brand` | Your main brand color, or `{ light, dark }` for a different one in each mode. Without one, the theme is ink, and so is a mode the pair leaves out |
|
|
31
|
+
| `accent` | The second emphasis color. Defaults to the brand color, or to ink with no brand. `{ from: 'brand', rotate: 180 }` gives the complementary color, and needs a brand |
|
|
31
32
|
| `background` | The page's color, `{ light, dark }`, for a page that is not pure white or pure black. The surfaces keep their contrast with it, and the grays take its tint. A page no text color can reach the contrast target on is refused |
|
|
32
33
|
| `neutral` | The gray ramp, which can be tinted toward the brand. With `background`, it takes the page's tint |
|
|
33
34
|
| `status` | `info`, `success`, `warning`, and `danger`. A color pins one. An object adjusts its hue while it keeps its meaning |
|
|
@@ -35,6 +36,12 @@ computed from `brand` or from the Helix design language. A theme that sets only
|
|
|
35
36
|
| `scheme` | `'light'` or `'dark'`, for a theme that has only one mode |
|
|
36
37
|
| `tokens` | Literal overrides by token name, for values no other field sets |
|
|
37
38
|
|
|
39
|
+
**A brand color that already meets the contrast target is used as it is.**
|
|
40
|
+
Where it clears every surface it lands on, it is the primary color, and where
|
|
41
|
+
its label clears on it, it is the fill. A navy brand stays navy on a light page.
|
|
42
|
+
A color that does not meet the target keeps its hue and chroma, and its
|
|
43
|
+
lightness moves only as far as the target needs.
|
|
44
|
+
|
|
38
45
|
`accent` can be defined relative to the brand. `status` colors cannot. If
|
|
39
46
|
`danger` rotated with the brand, your users would have to learn a new warning
|
|
40
47
|
color for each product.
|
|
@@ -47,7 +54,9 @@ settings:
|
|
|
47
54
|
- `scale` multiplies the chroma the brand color supplies.
|
|
48
55
|
|
|
49
56
|
Both apply to every derived color, including the brand color, because in a
|
|
50
|
-
monotone theme the brand is gray too.
|
|
57
|
+
monotone theme the brand is gray too. A gray brand is solved like any other, to
|
|
58
|
+
the gray nearest the page that meets the contrast target, which is a mid gray.
|
|
59
|
+
For black and white, leave out `brand`. Neither applies to a color you pinned. A
|
|
51
60
|
pinned color is used exactly as you set it.
|
|
52
61
|
|
|
53
62
|
## Contrast
|
package/content/maps.mdx
CHANGED
|
@@ -91,15 +91,15 @@ fixes a sanitizing flaw in earlier versions, so use 6.4.1 or later.
|
|
|
91
91
|
- Land uses `surface`.
|
|
92
92
|
- Water uses `info`.
|
|
93
93
|
- Parks use `success`.
|
|
94
|
-
- Main roads use `primary`, your brand color.
|
|
94
|
+
- Main roads use `primary`, your brand color, or ink with no brand.
|
|
95
95
|
- Smaller roads, buildings, borders, and labels use `foreground`.
|
|
96
96
|
|
|
97
97
|
It also draws landmarks, highway signs, and neighborhood names:
|
|
98
98
|
|
|
99
99
|
- A landmark is an icon on a disc and its name, in a color for its kind:
|
|
100
100
|
parks, museums, schools, hotels, hospitals, stations, and stadiums from zoom
|
|
101
|
-
14, and food and shops from zoom 16. Each color is a fixed hue at
|
|
102
|
-
|
|
101
|
+
14, and food and shops from zoom 16. Each color is a fixed hue at the
|
|
102
|
+
lightness of `primary`, so the kinds stay apart in any theme.
|
|
103
103
|
- A highway's number is on its sign, drawn to the Federal Highway
|
|
104
104
|
Administration's outlines: the red and blue Interstate shield, the white US
|
|
105
105
|
route shield, the white circle of a state route, and a plain plate for other
|