@propellerads/tokens 0.1.0 → 0.2.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/README.md +235 -58
- package/common.css +202 -63
- package/monetag.css +5 -5
- package/package.json +1 -1
- package/propellerads.css +4 -4
- package/propush.css +10 -4
- package/zeydoo.css +5 -3
package/README.md
CHANGED
|
@@ -18,19 +18,20 @@ Two files: the shared one and one brand. Both define variables on `:root`, they
|
|
|
18
18
|
define different names, and neither uses `@import` — so the order between them
|
|
19
19
|
does not matter.
|
|
20
20
|
|
|
21
|
-
`common.css` holds what every brand shares:
|
|
21
|
+
`common.css` holds what every brand shares: statuses, greys, overlays, the
|
|
22
22
|
spacing and type scales, breakpoints and shadows. A brand file holds three things:
|
|
23
23
|
its palette, its action colour and its typeface.
|
|
24
24
|
|
|
25
25
|
## What components read
|
|
26
26
|
|
|
27
|
-
Semantic names only — `--color-action`, `--color-
|
|
28
|
-
`--color-
|
|
27
|
+
Semantic names only — `--color-action`, `--color-rich`,
|
|
28
|
+
`--color-danger`, `--space-16`. Raw greys have no token of their own on
|
|
29
29
|
purpose: if they did, changing one border colour in one brand would drag along
|
|
30
30
|
every other place that grey is used.
|
|
31
31
|
|
|
32
32
|
Roles point at the brand palette through `var()`, so overriding `--color-action`
|
|
33
|
-
also moves everything built on it
|
|
33
|
+
also moves everything built on it. The same goes for the palette:
|
|
34
|
+
`--color-highlight` and its pad follow `--color-brand-primary`.
|
|
34
35
|
|
|
35
36
|
## In CSS and SCSS
|
|
36
37
|
|
|
@@ -39,9 +40,9 @@ Write the variable where the value goes. The browser resolves it against whateve
|
|
|
39
40
|
|
|
40
41
|
```css
|
|
41
42
|
.card {
|
|
42
|
-
background: var(--color-
|
|
43
|
-
color: var(--color-
|
|
44
|
-
border: 1px solid var(--color-
|
|
43
|
+
background: var(--color-light-inversion);
|
|
44
|
+
color: var(--color-dark-inversion);
|
|
45
|
+
border: 1px solid var(--color-rich);
|
|
45
46
|
padding: var(--space-16);
|
|
46
47
|
box-shadow: var(--shadow-middle);
|
|
47
48
|
}
|
|
@@ -55,7 +56,7 @@ Two things fail quietly:
|
|
|
55
56
|
|
|
56
57
|
```css
|
|
57
58
|
@media (max-width: var(--breakpoint-mobile)) { } /* a media query cannot read var() */
|
|
58
|
-
color: var(--over-
|
|
59
|
+
color: var(--over-fade); /* not a colour — see Overlays */
|
|
59
60
|
```
|
|
60
61
|
|
|
61
62
|
## In styled-components
|
|
@@ -70,8 +71,8 @@ the current value as a fallback, and reads only those below:
|
|
|
70
71
|
```ts
|
|
71
72
|
const Button = styled.button`
|
|
72
73
|
--button-bg: var(--color-action, hsl(210 100% 50%));
|
|
73
|
-
--button-bg-hover: color-mix(in srgb, var(--over-
|
|
74
|
-
--button-fg: var(--color-
|
|
74
|
+
--button-bg-hover: color-mix(in srgb, var(--over-deepen), var(--button-bg));
|
|
75
|
+
--button-fg: var(--color-light, hsl(0 0% 100%));
|
|
75
76
|
|
|
76
77
|
background: var(--button-bg);
|
|
77
78
|
color: var(--button-fg);
|
|
@@ -80,15 +81,40 @@ const Button = styled.button`
|
|
|
80
81
|
`;
|
|
81
82
|
```
|
|
82
83
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
84
|
+
The hover is mixed from `--button-bg` rather than from `--color-action`, and that
|
|
85
|
+
is the point: a button switched to the success tone darkens *its own* green. Mix
|
|
86
|
+
against the element's variable, never against the token it happens to hold today.
|
|
87
|
+
|
|
88
|
+
There is no `--color-action-hover`, and no hover token for anything else. A state
|
|
89
|
+
is not a colour of its own — it is the colour the element is already showing with
|
|
90
|
+
an overlay baked in, and a custom property cannot take that colour as an argument.
|
|
91
|
+
Two lines cover every case. An element that owns its surface deepens it:
|
|
92
|
+
|
|
93
|
+
```css
|
|
94
|
+
--thing-bg: var(--color-action);
|
|
95
|
+
--thing-bg-hover: color-mix(in srgb, var(--over-deepen), var(--thing-bg));
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
An element with no surface of its own — a ghost button, a link, a table row — has
|
|
99
|
+
nothing to deepen, so it wears its own tone at `--opacity-tint` instead, a film
|
|
100
|
+
over whatever it happens to be standing on:
|
|
101
|
+
|
|
102
|
+
```css
|
|
103
|
+
--thing-bg: transparent;
|
|
104
|
+
--thing-bg-hover: color-mix(in srgb, var(--thing-tone) var(--opacity-tint), transparent);
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
It cannot wash towards the page instead: over a panel or a photograph that wash
|
|
108
|
+
comes out the colour of a background the element is not on.
|
|
109
|
+
|
|
110
|
+
Pressed takes no third colour: move it a pixel. A third shade on top of the hover
|
|
111
|
+
only muddies it.
|
|
86
112
|
|
|
87
113
|
That block is also the component's override API, and needs no context — any
|
|
88
114
|
ancestor can set it:
|
|
89
115
|
|
|
90
116
|
```css
|
|
91
|
-
.checkout button { --button-bg: var(--color-
|
|
117
|
+
.checkout button { --button-bg: var(--color-success); }
|
|
92
118
|
```
|
|
93
119
|
|
|
94
120
|
A prop may still decide *which* token applies; what it must not do is carry the
|
|
@@ -110,7 +136,7 @@ back as the expression itself:
|
|
|
110
136
|
```js
|
|
111
137
|
const styles = getComputedStyle(document.documentElement);
|
|
112
138
|
styles.getPropertyValue('--breakpoint-mobile'); // '481px'
|
|
113
|
-
styles.getPropertyValue('--color-
|
|
139
|
+
styles.getPropertyValue('--color-danger-bg');
|
|
114
140
|
// 'color-mix(in srgb, hsl(0 0% 100%) 90%, hsl(0 85% 55%))'
|
|
115
141
|
```
|
|
116
142
|
|
|
@@ -119,7 +145,7 @@ a real property first and read that back:
|
|
|
119
145
|
|
|
120
146
|
```js
|
|
121
147
|
const probe = document.createElement('span');
|
|
122
|
-
probe.style.backgroundColor = 'var(--color-
|
|
148
|
+
probe.style.backgroundColor = 'var(--color-danger-bg)';
|
|
123
149
|
document.body.append(probe);
|
|
124
150
|
const colour = getComputedStyle(probe).backgroundColor; // 'rgb(253, 234, 234)'
|
|
125
151
|
probe.remove();
|
|
@@ -131,67 +157,144 @@ JavaScript does not.
|
|
|
131
157
|
|
|
132
158
|
## Colours
|
|
133
159
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
|
142
|
-
|
|
143
|
-
| `--color-
|
|
144
|
-
| `--color-
|
|
145
|
-
| `--color-
|
|
146
|
-
| `--color-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
160
|
+
The two ends of the scale are the one place where a name says where a colour sits
|
|
161
|
+
rather than what it does, because that is all a label on a filled button and the
|
|
162
|
+
stuff of an overlay have in common. `--color-light` is always the light end — text
|
|
163
|
+
and icons on a coloured surface, in both themes. `--color-light-inversion` is the page surface and
|
|
164
|
+
goes dark. Same pair for black: `--color-dark` is for overlays and stays
|
|
165
|
+
black, `--color-dark-inversion` is body text and flips.
|
|
166
|
+
|
|
167
|
+
| Token | Light | Dark | What it is for |
|
|
168
|
+
|----------------------------------|-----------|-----------|---------------------------------------------------|
|
|
169
|
+
| `--color-light` | `#FFFFFF` | `#E6E6E6` | Anything that keeps its colour whatever the theme — a label on a filled button, and the button tone for a surface the system does not own |
|
|
170
|
+
| `--color-light-inversion` | `#FFFFFF` | `#212121` | The page background |
|
|
171
|
+
| `--color-dark` | `#000000` | `#000000` | Anything that keeps its colour whatever the theme — what an overlay is made of |
|
|
172
|
+
| `--color-dark-inversion` | `#000000` | `#F2F2F2` | Body text |
|
|
173
|
+
|
|
174
|
+
Everything that carries no status at all is a triple of its own, shaped like a
|
|
175
|
+
status but with the colour taken out. What the grey scale has left after those
|
|
176
|
+
three steps is two dividers, told apart by whether they are meant to be noticed.
|
|
177
|
+
|
|
178
|
+
| Token | Light | Dark | What it is for |
|
|
179
|
+
|-----------------------|-----------|-----------|---------------------------------------------------|
|
|
180
|
+
| `--color-quiet` | `#B3B3B3` | `#737373` | Icons and anything drawn like one |
|
|
181
|
+
| `--color-quiet-bg` | `#FAFAFA` | `#333333` | Neutral pads on the page background |
|
|
182
|
+
| `--color-quiet-text` | `#808080` | `#999999` | Supporting text: the description and hints roles |
|
|
183
|
+
| `--color-formal` | `#F2F2F2` | `#262626` | Formal dividers — the ones that only order a list |
|
|
184
|
+
| `--color-rich` | `#CCCCCC` | `#4D4D4D` | Dividers that are meant to be seen |
|
|
185
|
+
|
|
186
|
+
The status colours are picked by what they say, never by their hue:
|
|
187
|
+
`--color-action` for interactive elements — buttons, links, controls;
|
|
188
|
+
`--color-success` for a scenario that worked; `--color-warning`
|
|
189
|
+
for a warning, where nothing is broken yet; `--color-danger` for errors,
|
|
190
|
+
scenarios that failed and actions that cannot be taken back. The action colour
|
|
191
|
+
carries the same pair — `--color-action-bg` and `--color-action-text` — for what
|
|
192
|
+
the interface is telling you rather than asking: a tip, a note, a highlighted row.
|
|
193
|
+
That pad is not a button's surface; a button fills itself with the action colour
|
|
194
|
+
itself.
|
|
195
|
+
|
|
196
|
+
None of them carries a `-hover`. A state is the colour the element is already
|
|
197
|
+
showing with an overlay baked in, and which overlay it is depends on the element
|
|
198
|
+
rather than on the colour: a form that owns its surface deepens that surface, a
|
|
199
|
+
form that does not washes the tone into a tint instead. One token cannot answer
|
|
200
|
+
both, so the rule lives with the component and this file only supplies what it
|
|
201
|
+
mixes with.
|
|
202
|
+
|
|
203
|
+
A status is a triple — the colour itself, the pad it sits on (`-bg`) and the
|
|
204
|
+
text on that pad (`-text`):
|
|
152
205
|
|
|
153
206
|
```css
|
|
154
207
|
.error {
|
|
155
|
-
background: var(--color-
|
|
156
|
-
color: var(--color-
|
|
208
|
+
background: var(--color-danger-bg);
|
|
209
|
+
color: var(--color-danger-text);
|
|
157
210
|
}
|
|
158
211
|
```
|
|
159
212
|
|
|
160
|
-
|
|
|
161
|
-
|
|
162
|
-
| `--color-
|
|
163
|
-
| `--color-
|
|
164
|
-
| `--color-
|
|
165
|
-
| `--color-
|
|
166
|
-
|
|
167
|
-
|
|
213
|
+
| Status | Value |
|
|
214
|
+
|-------------------|-----------|
|
|
215
|
+
| `--color-success` | `#00B359` |
|
|
216
|
+
| `--color-warning` | `#FFAA00` |
|
|
217
|
+
| `--color-danger` | `#EE2B2B` |
|
|
218
|
+
| `--color-action` | per brand |
|
|
219
|
+
|
|
220
|
+
`--color-highlight` takes the same three steps without being a status. It is the
|
|
221
|
+
brand's own colour worn by the interface — a promo panel, a tip, a block the page
|
|
222
|
+
wants noticed — so it points at the palette rather than at `--color-action`. Which
|
|
223
|
+
of the two palette colours it takes is the brand's call: it is the first one by
|
|
224
|
+
default, and Monetag and Zeydoo override it with the second in their own
|
|
225
|
+
files — Monetag because its first colour is already the action colour and a
|
|
226
|
+
highlight would be indistinguishable from it.
|
|
227
|
+
|
|
228
|
+
| Brand | `--color-highlight` | pad | text on the pad | dark pad | text there |
|
|
229
|
+
|---|---|---|---|---|---|
|
|
230
|
+
| PropellerAds | `#D9D926` first | `#FBFBE9` | 1.80 | `#464622` | 5.19 |
|
|
231
|
+
| Monetag | `#A4D65E` second | `#F6FBEF` | 2.00 | `#3B452D` | 4.78 |
|
|
232
|
+
| Propush | `#19D2FA` first | `#E8FAFE` | 2.09 | `#1F444C` | 4.68 |
|
|
233
|
+
| Zeydoo | `#28C8D2` second | `#E9FAFA` | 2.34 | `#224244` | 4.28 |
|
|
234
|
+
|
|
235
|
+
A status colour is picked to be read against; a palette colour is picked to be
|
|
236
|
+
looked at, and the pad inherits that. All four hold in the dark theme and none in the light
|
|
237
|
+
one, so this pad carries a shape, a heading or a short line, and a paragraph on it
|
|
238
|
+
stays on `--color-dark-inversion`.
|
|
239
|
+
|
|
240
|
+
The pads are the colour with an overlay baked in through `color-mix`, and that
|
|
168
241
|
overlay changes with the theme — so one formula covers both themes.
|
|
169
242
|
|
|
243
|
+
`-text` is the same colour darkened by a tenth. That lifts it off its own pad for
|
|
244
|
+
a label or a heading, and it is not enough for a paragraph: against its own pad
|
|
245
|
+
`danger` reaches 4.34, `success` 3.04 and `warning` 2.19, where body text asks for
|
|
246
|
+
4.5. A paragraph on a pad stays on `--color-dark-inversion`.
|
|
247
|
+
|
|
248
|
+
Anything drawn on a pad — an icon, a rule, a chart — is the status colour itself,
|
|
249
|
+
and it answers to 3:1 rather than 4.5. On its own pad only `danger` reaches it, at
|
|
250
|
+
3.62; `success` at 2.49, `warning` at 1.78 and `--color-quiet` at 2.01 do not, so
|
|
251
|
+
on those three a pad is a place for text and not for a shape that has to be made
|
|
252
|
+
out.
|
|
253
|
+
|
|
170
254
|
Per brand, `--color-action` is what buttons and links use; the palette is for
|
|
171
|
-
illustration and marketing surfaces.
|
|
172
|
-
|
|
255
|
+
illustration and marketing surfaces. Only Monetag makes its brand colour the
|
|
256
|
+
action colour — the Propush palette is a light cyan and a near-black, and
|
|
257
|
+
neither survives as a button.
|
|
173
258
|
|
|
174
259
|
| Token | PropellerAds | Monetag | Propush | Zeydoo |
|
|
175
260
|
|---------------------------|--------------|-----------|-----------|-----------|
|
|
176
261
|
| `--color-action` | `#0080FF` | `#4A3795` | `#0080FF` | `#0080FF` |
|
|
177
|
-
| `--color-brand-primary` | `#D9D926` | `#4A3795` |
|
|
178
|
-
| `--color-brand-secondary` | `#14B082` | `#A4D65E` |
|
|
262
|
+
| `--color-brand-primary` | `#D9D926` | `#4A3795` | `#19D2FA` | `#5C10DD` |
|
|
263
|
+
| `--color-brand-secondary` | `#14B082` | `#A4D65E` | `#231E1E` | `#28C8D2` |
|
|
179
264
|
| `--font-family` | Roboto | Gilroy | Roboto | Roboto |
|
|
180
265
|
|
|
181
266
|
## Overlays
|
|
182
267
|
|
|
183
|
-
|
|
184
|
-
|
|
268
|
+
There are three, and they are what the pads and the states are built from.
|
|
269
|
+
|
|
270
|
+
`--over-fullscreen` is a colour with alpha, for the dimming behind a modal or a
|
|
271
|
+
drawer:
|
|
185
272
|
|
|
186
273
|
```css
|
|
187
|
-
.
|
|
188
|
-
background-image: linear-gradient(var(--over-contour), var(--over-contour));
|
|
189
|
-
}
|
|
274
|
+
.scrim { background: var(--over-fullscreen); }
|
|
190
275
|
```
|
|
191
276
|
|
|
192
|
-
`--over-
|
|
193
|
-
|
|
194
|
-
|
|
277
|
+
`--over-fade` and `--over-deepen` are written as colour + amount, which is the
|
|
278
|
+
form `color-mix()` takes, because baking an overlay into a colour is the only
|
|
279
|
+
thing they are for. **They are not colours** — `background: var(--over-fade)`
|
|
280
|
+
does nothing. Use them like this:
|
|
281
|
+
|
|
282
|
+
```css
|
|
283
|
+
background: color-mix(in srgb, var(--over-deepen), var(--color-action));
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
They are named for what they do to a colour rather than for where it lands:
|
|
287
|
+
**fade** pushes it towards the background of the current theme, **deepen**
|
|
288
|
+
darkens it. Deepen builds both the text on a pad and the hover of a button, so
|
|
289
|
+
a name taken from either would lie about the other.
|
|
290
|
+
|
|
291
|
+
Fullscreen is the one of the three that is a colour with alpha rather than a
|
|
292
|
+
colour and an amount, because it is laid over the page rather than mixed into
|
|
293
|
+
something; the amount itself is `--opacity-fullscreen`.
|
|
294
|
+
|
|
295
|
+
Fade turns over with the theme — white in the light one, black in the dark — and
|
|
296
|
+
deepen is black in both. That is why no pad carries a dark value of its own: they
|
|
297
|
+
are built on fade, and fade has already turned over.
|
|
195
298
|
|
|
196
299
|
## Spacing and corners
|
|
197
300
|
|
|
@@ -216,6 +319,80 @@ reset, and `--space-1` is for hairlines and rules. A component may still use its
|
|
|
216
319
|
own padding internally for optical alignment — the scale governs the space
|
|
217
320
|
between things, not the inside of a control.
|
|
218
321
|
|
|
322
|
+
## Transparency
|
|
323
|
+
|
|
324
|
+
Three amounts, smallest first, and not a scale: the distance between two of them
|
|
325
|
+
means nothing, and none can stand in for another. What differs is the operation,
|
|
326
|
+
not the unit — two are the share of a colour a mix keeps, the third is how much of
|
|
327
|
+
an element is left, and `opacity` takes a percentage as readily as a number.
|
|
328
|
+
|
|
329
|
+
| Token | Value | What it is |
|
|
330
|
+
|---|---|---|
|
|
331
|
+
| `--opacity-tint` | `15%` | How much of its own colour an element with no surface of its own shows under the pointer |
|
|
332
|
+
| `--opacity-disabled` | `40%` | How much of a control that is switched off is left — its contour and its focus ring fade with it |
|
|
333
|
+
| `--opacity-fullscreen` | `50%` | How much of the dark end covers the page under a modal — `80%` in the dark theme |
|
|
334
|
+
|
|
335
|
+
```css
|
|
336
|
+
.thing:disabled { opacity: var(--opacity-disabled); }
|
|
337
|
+
.quiet:hover { background: color-mix(in srgb, var(--color-action) var(--opacity-tint), transparent); }
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
`--over-fullscreen` is built from the last of these rather than carrying a number
|
|
341
|
+
of its own, so the dark theme overrides the number and the overlay follows.
|
|
342
|
+
|
|
343
|
+
The tint is written from the colour's side on purpose. An element that owns no
|
|
344
|
+
surface cannot wash itself towards the page, because the page may not be what it
|
|
345
|
+
is standing on — over a panel or a photograph that wash comes out the wrong
|
|
346
|
+
colour. Its own colour at a low opacity is right on anything: darker on a dark
|
|
347
|
+
panel, paler on a light one.
|
|
348
|
+
|
|
349
|
+
## Motion
|
|
350
|
+
|
|
351
|
+
Duration is chosen by how far the thing travels and by who started it, not by how
|
|
352
|
+
important it is, and the name carries the value in milliseconds the way
|
|
353
|
+
`--space-16` carries pixels.
|
|
354
|
+
|
|
355
|
+
| Token | Use it for |
|
|
356
|
+
|------------------|------------------------------------------------------------------------------------------------|
|
|
357
|
+
| `--duration-100` | What answers something already under way: the press of a button, anything that has to land at once |
|
|
358
|
+
| `--duration-200` | What the pointer changes — hover and focus colours — and small things appearing beside what opened them: hints, tooltips, dropdowns |
|
|
359
|
+
| `--duration-300` | Something large crossing the page: modals, drawers, the mobile menu, a bar sliding in from an edge |
|
|
360
|
+
|
|
361
|
+
A colour travels nowhere, and still takes `--duration-200` when the pointer is
|
|
362
|
+
what changed it: at 100ms a hover reads as a flicker rather than as the interface
|
|
363
|
+
answering. The shortest step is for the other case — a press, where the finger is
|
|
364
|
+
already down and a fifth of a second reads as hesitation.
|
|
365
|
+
|
|
366
|
+
Anything that needs longer than `--duration-300` is a loading state, not a
|
|
367
|
+
transition.
|
|
368
|
+
|
|
369
|
+
Direction is carried by the easing, not by a second set of durations. What
|
|
370
|
+
arrives decelerates into place; what leaves accelerates out of the way and takes
|
|
371
|
+
the step below:
|
|
372
|
+
|
|
373
|
+
```css
|
|
374
|
+
.hint {
|
|
375
|
+
transition:
|
|
376
|
+
opacity var(--duration-200) var(--ease-flat),
|
|
377
|
+
transform var(--duration-200) var(--ease-enter);
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
.hint[hidden] {
|
|
381
|
+
transition-duration: var(--duration-100);
|
|
382
|
+
transition-timing-function: var(--ease-exit);
|
|
383
|
+
}
|
|
384
|
+
```
|
|
385
|
+
|
|
386
|
+
`--ease-enter` and `--ease-exit` are named for what the element does, not for the
|
|
387
|
+
CSS keywords, which invert: CSS `ease-in` starts slowly, which is what a *leaving*
|
|
388
|
+
element wants. `--ease-flat` is `linear`, for colour and opacity — a curve on a
|
|
389
|
+
colour reads as a stutter rather than as smoothness.
|
|
390
|
+
|
|
391
|
+
Two things a token cannot do for you. Do not transition `all`: with a duration
|
|
392
|
+
token it will also animate what should not move. And a `@keyframes` loop, a
|
|
393
|
+
spinner in particular, is outside this — `prefers-reduced-motion` cuts the
|
|
394
|
+
durations in `common.css`, but an animation has to answer that query itself.
|
|
395
|
+
|
|
219
396
|
## Dark theme
|
|
220
397
|
|
|
221
398
|
`common.css` switches on the operating system setting, and on `data-theme`:
|
|
@@ -226,8 +403,8 @@ between things, not the inside of a control.
|
|
|
226
403
|
<html> <!-- follows the system -->
|
|
227
404
|
```
|
|
228
405
|
|
|
229
|
-
Only the
|
|
230
|
-
|
|
406
|
+
Only the greys, the overlays and the shadows move; the brand palette and the
|
|
407
|
+
statuses are the same in both themes. The overrides are listed twice in the file,
|
|
231
408
|
once per switch, because a media query and a plain selector cannot share a rule —
|
|
232
409
|
**change a dark value in both blocks.**
|
|
233
410
|
|
package/common.css
CHANGED
|
@@ -4,49 +4,132 @@
|
|
|
4
4
|
everything pointing at them goes through var(). */
|
|
5
5
|
|
|
6
6
|
:root {
|
|
7
|
-
/*
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
--color-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
--color-
|
|
31
|
-
--color-
|
|
32
|
-
--color-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
7
|
+
/* The action colour is the brand's, so its pad and its text are built here from
|
|
8
|
+
whatever the brand file says it is. The pad is for what the interface is
|
|
9
|
+
telling you rather than asking — a tip, a note, a highlighted row — and it is
|
|
10
|
+
not a button's surface: a button fills itself with the action colour itself. */
|
|
11
|
+
--color-action-bg: color-mix(in srgb, var(--over-fade), var(--color-action));
|
|
12
|
+
--color-action-text: color-mix(in srgb, var(--over-deepen), var(--color-action));
|
|
13
|
+
|
|
14
|
+
/* Highlight ------------------------------------------------------------------
|
|
15
|
+
The brand's own colour put through the same three steps. It says nothing
|
|
16
|
+
about what happened — it marks something as ours: a promo panel, a block the
|
|
17
|
+
page wants noticed.
|
|
18
|
+
|
|
19
|
+
It is the palette seen from the interface side, so it points at the brand
|
|
20
|
+
palette rather than at --color-action. Which of the two palette colours it
|
|
21
|
+
takes is the brand's own call, and Monetag and Zeydoo say so in their files —
|
|
22
|
+
Monetag because its first colour is already the action colour, and highlight
|
|
23
|
+
built on it would be indistinguishable from an ordinary interactive element.
|
|
24
|
+
|
|
25
|
+
A status colour is picked to be read against; a palette colour is picked to
|
|
26
|
+
be looked at, and the pad inherits that — so the pad carries a shape, a
|
|
27
|
+
heading or a short line, and a paragraph on it stays on
|
|
28
|
+
--color-dark-inversion. The numbers, per brand and per theme, are printed on
|
|
29
|
+
the token page. */
|
|
30
|
+
--color-highlight: var(--color-brand-primary); /* The brand colour worn by the interface */
|
|
31
|
+
--color-highlight-bg: color-mix(in srgb, var(--over-fade), var(--color-highlight));
|
|
32
|
+
--color-highlight-text: color-mix(in srgb, var(--over-deepen), var(--color-highlight));
|
|
33
|
+
|
|
34
|
+
/* Statuses -----------------------------------------------------------------
|
|
35
|
+
Each one is a triple: the colour, the pad it sits on (-bg) and the text on
|
|
36
|
+
that pad (-text). The pad and the text are the colour with an overlay baked
|
|
37
|
+
in through color-mix, so one formula covers both themes.
|
|
38
|
+
|
|
39
|
+
The text step is a tenth of a darkening. That lifts it off its own pad for a
|
|
40
|
+
label or a heading, and it is not enough for a paragraph: against its own pad
|
|
41
|
+
danger reaches 4.34, success 3.04 and warning 2.19, where body text asks for
|
|
42
|
+
4.5. A paragraph on a pad stays on --color-dark-inversion. */
|
|
43
|
+
--color-success: hsl(150 100% 35%); /* #00B359 — a scenario that worked */
|
|
44
|
+
--color-success-bg: color-mix(in srgb, var(--over-fade), var(--color-success));
|
|
45
|
+
--color-success-text: color-mix(in srgb, var(--over-deepen), var(--color-success));
|
|
46
|
+
--color-warning: hsl(40 100% 50%); /* #FFAA00 — a warning: nothing is broken yet */
|
|
47
|
+
--color-warning-bg: color-mix(in srgb, var(--over-fade), var(--color-warning));
|
|
48
|
+
--color-warning-text: color-mix(in srgb, var(--over-deepen), var(--color-warning));
|
|
49
|
+
--color-danger: hsl(0 85% 55%); /* #EE2B2B — errors, scenarios that failed, and actions that cannot be taken back */
|
|
50
|
+
--color-danger-bg: color-mix(in srgb, var(--over-fade), var(--color-danger));
|
|
51
|
+
--color-danger-text: color-mix(in srgb, var(--over-deepen), var(--color-danger));
|
|
52
|
+
|
|
53
|
+
/* The same triple with the colour taken out, for everything that carries no
|
|
54
|
+
status at all. These three are written out rather than mixed: they are steps
|
|
55
|
+
of the grey scale in the design file, and its text step is deeper than the
|
|
56
|
+
tenth the statuses take. */
|
|
57
|
+
--color-quiet: hsl(0 0% 70%); /* #B3B3B3 — icons and anything drawn like one */
|
|
58
|
+
--color-quiet-bg: hsl(0 0% 98%); /* #FAFAFA — neutral pads on the page background */
|
|
59
|
+
--color-quiet-text: hsl(0 0% 50%); /* #808080 — supporting text: the description and hints roles */
|
|
60
|
+
|
|
61
|
+
/* The two ends -------------------------------------------------------
|
|
62
|
+
The ends of the scale, each in two versions. The plain one keeps its end
|
|
63
|
+
whatever the theme is: --color-light is what goes on a coloured surface,
|
|
64
|
+
--color-dark is what an overlay is made of. The -inversion one turns over
|
|
65
|
+
with the theme: it is the page surface and the body text.
|
|
66
|
+
|
|
67
|
+
Their names say the end rather than the job, which is the one place in this
|
|
68
|
+
file where that is the point: what a label on a filled button and the stuff
|
|
69
|
+
of an overlay have in common is only where they sit on the scale. */
|
|
70
|
+
--color-light: hsl(
|
|
71
|
+
0 0% 100%
|
|
72
|
+
); /* #FFFFFF — anything that keeps its colour whatever the theme, such as a label on a filled button */
|
|
73
|
+
--color-light-inversion: hsl(0 0% 100%); /* #FFFFFF — the page background */
|
|
74
|
+
--color-dark: hsl(
|
|
75
|
+
0 0% 0%
|
|
76
|
+
); /* #000000 — anything that keeps its colour whatever the theme, such as what an overlay is made of */
|
|
77
|
+
--color-dark-inversion: hsl(0 0% 0%); /* #000000 — body text */
|
|
78
|
+
|
|
79
|
+
/* Dividers -------------------------------------------------------------------
|
|
80
|
+
What the grey scale has left once the quiet triple has taken its three steps.
|
|
81
|
+
Both turn over with the theme. */
|
|
82
|
+
--color-formal: hsl(0 0% 95%); /* #F2F2F2 — formal dividers, the ones that only order a list */
|
|
83
|
+
--color-rich: hsl(0 0% 80%); /* #CCCCCC — dividers that are meant to be seen */
|
|
84
|
+
|
|
85
|
+
/* Transparency ---------------------------------------------------------------
|
|
86
|
+
Three amounts, smallest first, and not a scale: the distance between two of
|
|
87
|
+
them means nothing, and none can stand in for another. What differs is the
|
|
88
|
+
operation, not the unit — two are the share of a colour a mix keeps, the
|
|
89
|
+
third is how much of an element is left, and since `opacity` takes a
|
|
90
|
+
percentage as readily as a number they are all written the same way.
|
|
91
|
+
|
|
92
|
+
Every transparency in the file is here. --over-fullscreen is the one that is
|
|
93
|
+
also a colour, and it is built from the last of these rather than carrying
|
|
94
|
+
its own number, which is why the dark theme overrides the number and the
|
|
95
|
+
overlay follows on its own. */
|
|
96
|
+
--opacity-tint: 15%; /* How much of its own colour an element with no surface of its own shows under the pointer, the rest left transparent */
|
|
97
|
+
--opacity-disabled: 40%; /* A control that is switched off — the whole element at once, its contour and its focus ring included */
|
|
98
|
+
--opacity-fullscreen: 50%; /* How much of the dark end covers the page under a modal — 80% in the dark theme, where the page it hides is already dark */
|
|
40
99
|
|
|
41
100
|
/* Overlays ----------------------------------------------------------------
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
101
|
+
Three, and they are what the pads and the states are built from.
|
|
102
|
+
|
|
103
|
+
Fullscreen is a colour with alpha, laid over the page. The other two are
|
|
104
|
+
written as colour + amount, which is the form color-mix() takes, because that
|
|
105
|
+
is the only thing they are ever used for: baking an overlay into a colour
|
|
106
|
+
rather than laying on a second layer. They are named for what they do to a
|
|
107
|
+
colour instead of for where they land — fade washes it out, deepen darkens
|
|
108
|
+
it — because deepen builds the contour of a pad and the hover of a button,
|
|
109
|
+
and a name taken from either would lie about the other.
|
|
110
|
+
|
|
111
|
+
Every one of them is made of a token from the scale rather than a literal.
|
|
112
|
+
Fade rides --color-light-inversion, which is the page surface, so it
|
|
113
|
+
turns over with the theme and no pad needs a dark value of its own: only the
|
|
114
|
+
amount is written twice. Deepen rides --color-dark, which does not
|
|
115
|
+
turn over, so it darkens in both themes — the way the design file has it,
|
|
116
|
+
and the way the name reads.
|
|
117
|
+
|
|
118
|
+
States are not tokens. A state is the colour the element is already showing
|
|
119
|
+
with one of these baked in, and which overlay depends on the element: a form
|
|
120
|
+
that owns its surface deepens it, a form that does not washes the tone into a
|
|
121
|
+
tint instead. A custom property cannot express either, because it cannot take
|
|
122
|
+
the element's colour as its argument — so the rule lives with the component,
|
|
123
|
+
and this file only supplies what it mixes with. The README has the lines.
|
|
124
|
+
|
|
125
|
+
Pressed takes no third colour and moves a pixel instead. */
|
|
126
|
+
--over-fullscreen: color-mix(
|
|
127
|
+
in srgb,
|
|
128
|
+
var(--color-dark) var(--opacity-fullscreen),
|
|
129
|
+
transparent
|
|
130
|
+
); /* Dimming behind modals and drawers */
|
|
131
|
+
--over-deepen: var(--color-dark) 10%; /* Darkens a colour in both themes: pad contours, hover */
|
|
132
|
+
--over-fade: var(--color-light-inversion) 90%; /* Towards the page surface: pads */
|
|
50
133
|
|
|
51
134
|
/* Typography --------------------------------------------------------------
|
|
52
135
|
Ten roles, named for the job rather than the size, because three of them are
|
|
@@ -119,11 +202,44 @@
|
|
|
119
202
|
--shadow-middle: 0 1px 1px hsl(0 0% 0% / 0.05), 0 2px 8px hsl(0 0% 0% / 0.1); /* Default container shadow */
|
|
120
203
|
--shadow-big:
|
|
121
204
|
0 0 3px hsl(0 0% 0% / 0.06), 0 4px 4px hsl(0 0% 0% / 0.05), 0 12px 16px hsl(0 0% 0% / 0.1); /* Large containers over an overlay, promo blocks */
|
|
205
|
+
|
|
206
|
+
/* Motion ------------------------------------------------------------------
|
|
207
|
+
Duration by how far the thing travels and by who started it, not by how
|
|
208
|
+
important it is — so the step can be read off the change itself rather than
|
|
209
|
+
off the component. The name carries the value in milliseconds, the way
|
|
210
|
+
--space-16 carries pixels.
|
|
211
|
+
|
|
212
|
+
A colour travels nowhere, but a colour the pointer changes still takes
|
|
213
|
+
--duration-200: at 100ms a hover reads as a flicker rather than as the
|
|
214
|
+
interface answering. The shortest step is for what answers something already
|
|
215
|
+
under way — a press, where the finger is already down and a fifth of a second
|
|
216
|
+
reads as hesitation.
|
|
217
|
+
|
|
218
|
+
Direction lives in the easing rather than in a second set of durations: what
|
|
219
|
+
arrives decelerates into place, what leaves accelerates out of the way and
|
|
220
|
+
takes the step below — a hint enters in --duration-200 and leaves in
|
|
221
|
+
--duration-100.
|
|
222
|
+
|
|
223
|
+
The easings are named for what the element does, not for the CSS keyword,
|
|
224
|
+
because the keywords invert: CSS `ease-in` starts slowly, which is what a
|
|
225
|
+
leaving element wants, and that trips everyone at least once.
|
|
226
|
+
|
|
227
|
+
Below --duration-100 a change reads as lag, because the pointer has already
|
|
228
|
+
moved on; above --duration-300 the interface reads as slow. Anything that
|
|
229
|
+
genuinely needs longer is a loading state, not a transition. */
|
|
230
|
+
|
|
231
|
+
--duration-100: 100ms; /* Answers something already under way: the press of a button, anything that has to land at once */
|
|
232
|
+
--duration-200: 200ms; /* What the pointer changes — hover and focus colours — and small things appearing beside what opened them: hints, tooltips, dropdowns */
|
|
233
|
+
--duration-300: 300ms; /* Something large crosses the page — modals, drawers, the mobile menu, a bar sliding in from an edge */
|
|
234
|
+
|
|
235
|
+
--ease-enter: cubic-bezier(0, 0, 0.2, 1); /* Arrives: fast start, soft landing */
|
|
236
|
+
--ease-exit: cubic-bezier(0.4, 0, 1, 1); /* Leaves: gathers speed and is gone */
|
|
237
|
+
--ease-flat: linear; /* Colour and opacity, where a curve reads as a stutter */
|
|
122
238
|
}
|
|
123
239
|
|
|
124
240
|
/* Dark theme --------------------------------------------------------------
|
|
125
|
-
Only the
|
|
126
|
-
|
|
241
|
+
Only the greys, the overlays and the shadows move; the brand palette and the
|
|
242
|
+
statuses are the same in both themes.
|
|
127
243
|
|
|
128
244
|
The same list appears twice on purpose. The first block follows the operating
|
|
129
245
|
system, the second follows an explicit choice the product writes onto <html>
|
|
@@ -136,17 +252,19 @@
|
|
|
136
252
|
:root:not([data-theme="light"]) {
|
|
137
253
|
color-scheme: dark;
|
|
138
254
|
|
|
139
|
-
--color-
|
|
140
|
-
--color-
|
|
141
|
-
--color-
|
|
142
|
-
|
|
143
|
-
--color-
|
|
144
|
-
--color-
|
|
145
|
-
--color-
|
|
255
|
+
--color-light: hsl(0 0% 90%); /* #E6E6E6 */
|
|
256
|
+
--color-light-inversion: hsl(0 0% 13%); /* #212121 */
|
|
257
|
+
--color-dark-inversion: hsl(0 0% 95%); /* #F2F2F2 — body text sits nearer white than the light end does */
|
|
258
|
+
|
|
259
|
+
--color-quiet: hsl(0 0% 45%); /* #737373 */
|
|
260
|
+
--color-quiet-bg: hsl(0 0% 20%); /* #333333 */
|
|
261
|
+
--color-quiet-text: hsl(0 0% 60%); /* #999999 */
|
|
262
|
+
|
|
263
|
+
--color-formal: hsl(0 0% 15%); /* #262626 */
|
|
264
|
+
--color-rich: hsl(0 0% 30%); /* #4D4D4D */
|
|
146
265
|
|
|
147
|
-
--
|
|
148
|
-
--over-
|
|
149
|
-
--over-bg-mix: hsl(0 0% 0%) 80%; /* Inverts too — and the pads built on it follow without being repeated */
|
|
266
|
+
--opacity-fullscreen: 80%;
|
|
267
|
+
--over-fade: var(--color-light-inversion) 80%; /* Only the amount is here: the colours turn over on their own */
|
|
150
268
|
|
|
151
269
|
--shadow-little: 0 1px 0 hsl(0 0% 0% / 0.25), 0 1px 4px hsl(0 0% 0% / 0.6);
|
|
152
270
|
--shadow-middle: 0 1px 1px hsl(0 0% 0% / 0.35), 0 2px 8px hsl(0 0% 0% / 0.6);
|
|
@@ -157,17 +275,19 @@
|
|
|
157
275
|
:root[data-theme="dark"] {
|
|
158
276
|
color-scheme: dark;
|
|
159
277
|
|
|
160
|
-
--color-
|
|
161
|
-
--color-
|
|
162
|
-
--color-
|
|
163
|
-
--color-shade-contour: hsl(0 0% 10%); /* #1A1A1A */
|
|
164
|
-
--color-shade-graphic: hsl(0 0% 45%); /* #737373 */
|
|
165
|
-
--color-shade-dark: hsl(0 0% 60%); /* #999999 */
|
|
166
|
-
--color-shade-black-inverter: hsl(0 0% 90%); /* #E6E6E6 */
|
|
278
|
+
--color-light: hsl(0 0% 90%); /* #E6E6E6 */
|
|
279
|
+
--color-light-inversion: hsl(0 0% 13%); /* #212121 */
|
|
280
|
+
--color-dark-inversion: hsl(0 0% 95%); /* #F2F2F2 — body text sits nearer white than the light end does */
|
|
167
281
|
|
|
168
|
-
--
|
|
169
|
-
--
|
|
170
|
-
--
|
|
282
|
+
--color-quiet: hsl(0 0% 45%); /* #737373 */
|
|
283
|
+
--color-quiet-bg: hsl(0 0% 20%); /* #333333 */
|
|
284
|
+
--color-quiet-text: hsl(0 0% 60%); /* #999999 */
|
|
285
|
+
|
|
286
|
+
--color-formal: hsl(0 0% 15%); /* #262626 */
|
|
287
|
+
--color-rich: hsl(0 0% 30%); /* #4D4D4D */
|
|
288
|
+
|
|
289
|
+
--opacity-fullscreen: 80%;
|
|
290
|
+
--over-fade: var(--color-light-inversion) 80%; /* Only the amount is here: the colours turn over on their own */
|
|
171
291
|
|
|
172
292
|
--shadow-little: 0 1px 0 hsl(0 0% 0% / 0.25), 0 1px 4px hsl(0 0% 0% / 0.6);
|
|
173
293
|
--shadow-middle: 0 1px 1px hsl(0 0% 0% / 0.35), 0 2px 8px hsl(0 0% 0% / 0.6);
|
|
@@ -185,3 +305,22 @@
|
|
|
185
305
|
--font-h2: 700 18px / normal var(--font-family);
|
|
186
306
|
}
|
|
187
307
|
}
|
|
308
|
+
|
|
309
|
+
/* Reduced motion ----------------------------------------------------------
|
|
310
|
+
For some people motion is a vestibular problem rather than a taste. Cutting
|
|
311
|
+
the durations in one place leaves every transition where it is — the states
|
|
312
|
+
just arrive at once — and this is the argument for durations being tokens at
|
|
313
|
+
all: without them this query would have to name twenty files. A @keyframes
|
|
314
|
+
loop is not covered, because a token cannot reach inside an animation; a
|
|
315
|
+
spinner answers this query itself.
|
|
316
|
+
|
|
317
|
+
0.01ms rather than 0 on purpose: a zero-length transition fires no
|
|
318
|
+
transitionend, and a component that unmounts on that event would hang. */
|
|
319
|
+
|
|
320
|
+
@media (prefers-reduced-motion: reduce) {
|
|
321
|
+
:root {
|
|
322
|
+
--duration-100: 0.01ms;
|
|
323
|
+
--duration-200: 0.01ms;
|
|
324
|
+
--duration-300: 0.01ms;
|
|
325
|
+
}
|
|
326
|
+
}
|
package/monetag.css
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/* Monetag. Import together with common.css. */
|
|
2
2
|
|
|
3
3
|
:root {
|
|
4
|
-
--color-brand-primary: hsl(252.1 46.1% 40%);
|
|
5
|
-
--color-brand-secondary: hsl(85 59.4% 60.4%);
|
|
4
|
+
--color-brand-primary: hsl(252.1 46.1% 40%);
|
|
5
|
+
--color-brand-secondary: hsl(85 59.4% 60.4%);
|
|
6
6
|
|
|
7
|
-
--color-action: var(
|
|
8
|
-
|
|
9
|
-
); /*
|
|
7
|
+
--color-action: var(--color-brand-primary); /* No action colour of its own: the brand one plays that role */
|
|
8
|
+
|
|
9
|
+
--color-highlight: var(--color-brand-secondary); /* The first colour is already the action colour here */
|
|
10
10
|
|
|
11
11
|
--font-family: "Gilroy", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
12
12
|
}
|
package/package.json
CHANGED
package/propellerads.css
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/* PropellerAds. Import together with common.css. The brand palette is the only
|
|
2
|
-
place where brands differ in colour;
|
|
2
|
+
place where brands differ in colour; statuses, greys, sizes and shadows are
|
|
3
3
|
shared. */
|
|
4
4
|
|
|
5
5
|
:root {
|
|
6
|
-
--color-brand-primary: hsl(60 70.2% 50%); /*
|
|
7
|
-
--color-brand-secondary: hsl(162.3 79.6% 38.4%);
|
|
6
|
+
--color-brand-primary: hsl(60 70.2% 50%); /* Not used for buttons */
|
|
7
|
+
--color-brand-secondary: hsl(162.3 79.6% 38.4%);
|
|
8
8
|
|
|
9
|
-
--color-action: hsl(210 100% 50%); /*
|
|
9
|
+
--color-action: hsl(210 100% 50%); /* Interactive elements: buttons, links, controls */
|
|
10
10
|
|
|
11
11
|
--font-family: "Roboto", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
12
12
|
}
|
package/propush.css
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
|
-
/* Propush. Import together with common.css.
|
|
1
|
+
/* Propush. Import together with common.css. The brand palette is the only place
|
|
2
|
+
where brands differ in colour; statuses, greys, sizes and shadows are shared.
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
|
|
4
|
+
The two brand values carry a decimal: rounded to whole degrees and percent
|
|
5
|
+
they land a step off the hex the design file gives. */
|
|
5
6
|
|
|
6
7
|
:root {
|
|
7
|
-
--color-
|
|
8
|
+
--color-brand-primary: hsl(190.7 95.7% 53.9%);
|
|
9
|
+
--color-brand-secondary: hsl(0 7.7% 12.7%);
|
|
10
|
+
|
|
11
|
+
/* Neither brand value works as the action colour — one is a light cyan, the
|
|
12
|
+
other a near-black — so it stays the blue PropellerAds uses. */
|
|
13
|
+
--color-action: hsl(210 100% 50%); /* Interactive elements: buttons, links, controls */
|
|
8
14
|
|
|
9
15
|
--font-family: "Roboto", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
10
16
|
}
|
package/zeydoo.css
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
/* Zeydoo. Import together with common.css. */
|
|
2
2
|
|
|
3
3
|
:root {
|
|
4
|
-
--color-brand-primary: hsl(262.2 86.5% 46.5%);
|
|
5
|
-
--color-brand-secondary: hsl(183.5 68% 49%);
|
|
4
|
+
--color-brand-primary: hsl(262.2 86.5% 46.5%);
|
|
5
|
+
--color-brand-secondary: hsl(183.5 68% 49%);
|
|
6
6
|
|
|
7
|
-
--color-action: hsl(210 100% 50%); /*
|
|
7
|
+
--color-action: hsl(210 100% 50%); /* Interactive elements: buttons, links, controls */
|
|
8
|
+
|
|
9
|
+
--color-highlight: var(--color-brand-secondary);
|
|
8
10
|
|
|
9
11
|
--font-family: "Roboto", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
10
12
|
}
|