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
{{ message }}
Repository navigation
Commit 0f0d15a
Browse filesBrowse the repository at this point in the historyBrowse files
feat(tokens): a 12-step gray ramp under the neutral color tokens
Each theme now defines --mu-gray-1 to --mu-gray-12, and every neutral
color token points at a step instead of its own hex. Values that sat
within a few levels of each other share a step, so a few colors move
slightly:
- Light: canvas and key-hover #fafafa (was #f9f9f9, #fbfbfb), hover
#ececec (#ededed), line #dedede (#e0e0e0), primary #1a1a1a (#1f1f1f).
- Dark: well, hover and line #252525 (#262626, #242424, #262626),
edge #343434 (#353535), on-primary #0f0f0f (#111111), primary-hover
#ffffff (#f5f5f5).
The ramp is internal, like space and radius: apps read a step for their
own parts but don't override it, and themeTokens is unchanged. Steps
7-9 are free. docs/color.md documents the ramp; tokens.test.ts checks
the 12 steps and that no neutral token is a raw gray hex, and
contrast.test.ts resolves the var() references.
Copy file name to clipboardExpand all lines: docs/color.md
+39-16Lines changed: 39 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -30,7 +30,7 @@ Memos UI is ink on paper: pure-gray neutrals, `primary` ink for emphasis, one qu
30
30
31
31
There are two themes: **Light** (the default) and **Dark**.
32
32
33
-
- Each theme sets every color token and every shadow token to an explicit value. Nothing is derived at runtime. The package's tests check the values against the tables on this page and in [Depth](depth.md), and check the contrast promised here.
33
+
- Each theme sets the [gray ramp](#gray-ramp), every color token and every shadow token. Neutral color tokens point at a ramp step; nothing else is derived at runtime. The package's tests check the values against the tables on this page and in [Depth](depth.md), and check the contrast promised here.
34
34
- Dark keeps the same depth model. Wells go darker than `canvas`, keys go lighter, `key-sheen` drops to 8%, and `primary` flips to near-white with a dark `on-primary`.
35
35
- Non-text contrast: `edge` is about 1.5:1 in Light and Dark. That is the soft border people expect from a calm interface, and it is below WCAG's 3:1 for control boundaries. An app that needs 3:1 boundaries defines its own [app theme](#app-themes) with a darker `edge` and outlined keys.
36
36
@@ -44,7 +44,7 @@ The package does not read `prefers-color-scheme` itself. The app does, so that a
44
44
45
45
An app sets only these tokens:
46
46
47
-
- the 26 color tokens in the [table below](#color-tokens),
47
+
- the 27 color tokens in the [table below](#color-tokens),
48
48
- the five shadow tokens in [Depth](depth.md#shadow-tokens),
49
49
- the three font tokens in [Typography](typography.md#fonts): `font-sans`, `font-display` and `font-mono`.
50
50
@@ -66,7 +66,7 @@ An app can offer more themes than the two the package ships, such as a warm Pape
66
66
```
67
67
68
68
- Set every color token in the table below and the five shadow tokens in [Depth](depth.md). A token the theme leaves out keeps its Light value, so a partial theme mixes two palettes.
69
-
- The package exports `themeTokens`, the custom property names of those 31 tokens (`--mu-canvas` to `--mu-shadow-pop`). Check in the app's tests that its theme sets each one:
69
+
- The package exports `themeTokens`, the custom property names of those 32 tokens (`--mu-canvas` to `--mu-shadow-pop`). Check in the app's tests that its theme sets each one:
70
70
71
71
```ts
72
72
import { themeTokens } from"@usememos/ui";
@@ -81,25 +81,48 @@ An app can offer more themes than the two the package ships, such as a warm Pape
81
81
- The tokens sit in the `mu`[cascade layer](building.md#cascade-layer), so an unlayered app theme wins over them at any specificity.
82
82
- An app theme is a choice the user makes. It is not a way to restyle the package per product: an app's default theme is Light or Dark.
83
83
84
+
## Gray ramp
85
+
86
+
Every neutral color comes from one 12-step gray ramp per theme. Step 1 is the page and step 12 is the strongest text; Light runs light to dark and Dark runs dark to light. The neutral color tokens below point at a step (`hover` is `var(--mu-gray-3)`); only white and the hues are written out.
87
+
88
+
- The ramp is internal, like space and radius. Apps read a step for their own parts (`var(--mu-gray-7)` for a chart grid line) but don't override it, and an [app theme](#app-themes) sets the color tokens, not the ramp.
89
+
- Steps 1 to 6 are fills and lines, 7 to 9 are free for app parts, 10 to 12 are text. A step marked free has no token on it yet.
90
+
- A new neutral token points at an existing step. Add a step only with a written reason here.
|`well`|`#e4e4e4`|`#262626`| Recessed parts that hold a state: switch, tab, checkbox and radio wells, pressed toggles, inline code. Paired with `edge` and `shadow-track`. Not for text entry |
91
-
|`hover`|`#ededed`|`#242424`| Hover on rows, ghost buttons and wells; the highlighted row in menus and selects |
92
-
|`key`|`#ffffff`|`#343434`| Raised parts you press: neutral buttons, select triggers, the selected tab, switch knobs, kbd. Paired with `shadow-key` or `shadow-raised`|
93
-
|`key-hover`|`#fbfbfb`|`#3c3c3c`| Hover on a neutral key |
|`well`|`var(--mu-gray-4)`|`var(--mu-gray-3)`| Recessed parts that hold a state: switch, tab, checkbox and radio wells, pressed toggles, inline code. Paired with `edge` and `shadow-track`. Not for text entry |
114
+
|`hover`|`var(--mu-gray-3)`|`var(--mu-gray-3)`| Hover on rows, ghost buttons and wells; the highlighted row in menus and selects |
115
+
|`key`|`#ffffff`|`var(--mu-gray-4)`| Raised parts you press: neutral buttons, select triggers, the selected tab, switch knobs, kbd. Paired with `shadow-key` or `shadow-raised`|
116
+
|`key-hover`|`var(--mu-gray-1)`|`var(--mu-gray-5)`| Hover on a neutral key |
94
117
|`key-sheen`|`rgba(255,255,255,0.18)`|`rgba(255,255,255,0.08)`| Top light on keys: a gradient from `key-sheen` at the top edge to clear at 60% of the height |
95
-
|`edge`|`#d0d0d0`|`#353535`| 1px border of inputs and wells. About 1.5:1 on canvas |
96
-
|`line`|`#e0e0e0`|`#262626`| Separators, table rules and menu dividers. 1.25:1 in Light, so structural lines also need spacing or a heading |
118
+
|`edge`|`var(--mu-gray-6)`|`var(--mu-gray-4)`| 1px border of inputs and wells. About 1.5:1 on canvas |
119
+
|`line`|`var(--mu-gray-5)`|`var(--mu-gray-3)`| Separators, table rules and menu dividers. 1.25:1 in Light, so structural lines also need spacing or a heading |
97
120
|`overlay`|`rgba(0,0,0,0.32)`|`rgba(0,0,0,0.6)`| Backdrop behind dialogs and sheets |
98
-
|`ink`|`#1a1a1a`|`#ededed`| Primary text and icons on canvas, surface, well and key (13:1 or more in both themes) |
99
-
|`ink-muted`|`#5e5e5e`|`#adadad`| Secondary text: descriptions, placeholders, unselected tabs and toggles, shortcuts, timestamps (4.9:1 or more on every surface) |
100
-
|`primary`|`#1f1f1f`|`#e6e6e6`| The one emphasized action and every on state: primary buttons, checked boxes and radios, switches when on, tooltips. Ink, not a hue |
101
-
|`primary-hover`|`#333333`|`#f5f5f5`| Hover on a primary key |
102
-
|`on-primary`|`#ffffff`|`#111111`| Text, icons and the switch knob on `primary` (16:1 Light, 15:1 Dark) |
121
+
|`ink`|`var(--mu-gray-12)`|`var(--mu-gray-12)`| Primary text and icons on canvas, surface, well and key (13:1 or more in both themes) |
122
+
|`ink-muted`|`var(--mu-gray-10)`|`var(--mu-gray-10)`| Secondary text: descriptions, placeholders, unselected tabs and toggles, shortcuts, timestamps (4.9:1 or more on every surface) |
123
+
|`primary`|`var(--mu-gray-12)`|`var(--mu-gray-11)`| The one emphasized action and every on state: primary buttons, checked boxes and radios, switches when on, tooltips. Ink, not a hue |
124
+
|`primary-hover`|`var(--mu-gray-11)`|`#ffffff`| Hover on a primary key |
125
+
|`on-primary`|`#ffffff`|`var(--mu-gray-1)`| Text, icons and the switch knob on `primary` (16:1 Light, 15:1 Dark) |
103
126
|`accent`|`oklch(0.5 0.13 255)`|`oklch(0.78 0.11 255)`| The only hue at rest: links, the text cursor and selection. 5.8:1 on canvas in Light. Never a fill |
104
127
|`selection`|`rgba(40,99,171,0.18)`|`rgba(135,186,253,0.28)`| Text selection and the selected range in an editor |
105
128
|`focus`|`var(--mu-primary)`|`var(--mu-primary)`| Keyboard focus ring: 2px outline, 1px offset, on `:focus-visible` only |
Copy file name to clipboardExpand all lines: docs/custom-components.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -119,7 +119,7 @@ An app on Tailwind CSS v4 loads `tailwind.css` after the package's other stylesh
119
119
@import"@usememos/ui/tailwind.css";
120
120
```
121
121
122
-
It maps the 26 color tokens, five shadow tokens, seven radius tokens and three font tokens to utilities with an `mu-` prefix, so they never clash with an app's own colors:
122
+
It maps the 27 color tokens, five shadow tokens, seven radius tokens and three font tokens to utilities with an `mu-` prefix, so they never clash with an app's own colors:
0 commit comments