@crewlethq/tokens 0.131.0 → 0.131.1
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/dist/css/brand.css +6 -69
- package/package.json +1 -1
package/dist/css/brand.css
CHANGED
|
@@ -1,78 +1,15 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* The brand mapping
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* THE ONE SOURCE OF THE MAPPING. Two stylesheets are built from this file and
|
|
7
|
-
* nothing else, so the rules cannot come to differ between them:
|
|
8
|
-
*
|
|
9
|
-
* dist/css/brand.css this file as it is, on the document root: the
|
|
10
|
-
* layer @crewlethq/artifact-kit bundles into
|
|
11
|
-
* kit.css, under every artifact page;
|
|
12
|
-
* dist/css/brand-scope.css the same blocks with their selectors moved onto
|
|
13
|
-
* `.crewlet-brand-scope__layer`, plus the capture
|
|
14
|
-
* of the page's own values (src/brand.ts): the
|
|
15
|
-
* stylesheet of @crewlethq/ui's BrandScope, which
|
|
16
|
-
* brands one region of an application and leaves
|
|
17
|
-
* its chrome alone.
|
|
18
|
-
*
|
|
19
|
-
* The build accepts exactly the three selectors below and stops on any other,
|
|
20
|
-
* so a rule added here reaches both or neither.
|
|
21
|
-
*
|
|
22
|
-
* THE INPUTS ARE `--brand-*` CUSTOM PROPERTIES, and only those. None is
|
|
23
|
-
* required:
|
|
24
|
-
*
|
|
25
|
-
* --brand-primary the brand's main colour, #rrggbb
|
|
26
|
-
* --brand-primary-on-dark the main colour on a dark ground, if it differs
|
|
27
|
-
* --brand-secondary a second colour, for highlights and gradients
|
|
28
|
-
* --brand-text body text on the light ground
|
|
29
|
-
* --brand-light-ground the page's ground in light mode
|
|
30
|
-
* --brand-dark-ground the page's ground in dark mode
|
|
31
|
-
* --brand-font-heading a font-family list for headings
|
|
32
|
-
* --brand-font-body a font-family list for everything else
|
|
33
|
-
*
|
|
34
|
-
* (The artifact kit's logo class reads the logo inputs beside these.)
|
|
35
|
-
*
|
|
36
|
-
* THE PUBLIC TOKENS KEEP THEIR NAMES. A surface that already paints with
|
|
37
|
-
* `var(--color-brand-accent)` or `var(--font-family-display)` follows the
|
|
38
|
-
* brand. Each is declared here, once, as the brand's value or, where its
|
|
39
|
-
* input is not set, the theme's own value under `--crewlet-theme-<name>`. A
|
|
40
|
-
* custom property cannot fall back to its own earlier value, which is why the
|
|
41
|
-
* theme's values take a second name: the kit's build moves every token
|
|
42
|
-
* declaration to it, and the scope captures the page's values into it one
|
|
43
|
-
* element up.
|
|
44
|
-
*
|
|
45
|
-
* WITH NO INPUT SET, NOTHING CHANGES. Every derived value below is a private
|
|
46
|
-
* `--crewlet-brand-*` that names an input with no fallback, so with the input
|
|
47
|
-
* unset it is invalid at computed-value time, and the public token falls
|
|
48
|
-
* back to the theme's value exactly as the theme declared it. A step a mode
|
|
49
|
-
* has no input for is declared `initial` (the guaranteed-invalid value), so
|
|
50
|
-
* every mode block names the same steps and no mode inherits another's.
|
|
51
|
-
*
|
|
52
|
-
* ONE INPUT, THE WHOLE FAMILY. With `--brand-primary` set, the hover, press,
|
|
53
|
-
* ink, soft fills, selected edge, deep stop and glow are mixed from it with
|
|
54
|
-
* `color-mix()` in each mode, and the label on it is whichever of black and
|
|
55
|
-
* white clears more contrast on it. A body face alone sets the headings too.
|
|
56
|
-
*
|
|
57
|
-
* THE INK IS TEXT, SO IT CLEARS 4.5:1. The accent's ink (the accent written as
|
|
58
|
-
* words: a link, a sample's link) is the accent mixed toward the ink that
|
|
59
|
-
* clears more on the mode's ground, then taken further toward it only where
|
|
60
|
-
* that is still short of 4.5:1, in linear light, where a colour's WCAG
|
|
61
|
-
* luminance is the weighted sum of its channels: on a light ground its
|
|
62
|
-
* channels are scaled until its luminance is at most 0.15 (4.5:1 on any
|
|
63
|
-
* ground of 0.85 or lighter), on a dark ground lifted toward white until it
|
|
64
|
-
* is at least 0.265 (4.5:1 on any ground of 0.02 or darker). Mixed alone, a
|
|
65
|
-
* light brand colour wrote a 3.3:1 ink. An ink that already clears is the mix
|
|
66
|
-
* as it was.
|
|
67
|
-
* The focus ring stays the theme's: its 3:1 floor is measured for every theme,
|
|
68
|
-
* and a mix of an arbitrary colour cannot be. `--color-brand-accent-rgb` stays
|
|
69
|
-
* the theme's too, because a channel triple cannot be derived in CSS; a page
|
|
70
|
-
* tints with `color-mix(in srgb, var(--color-brand-accent) 20%, transparent)`.
|
|
2
|
+
* The brand mapping, the one source of css/brand.css and css/brand-scope.css:
|
|
3
|
+
* `--brand-*` inputs restyle the public tokens. The build accepts only the
|
|
4
|
+
* three selectors below, and an unset input leaves the theme's value.
|
|
71
5
|
*/
|
|
72
6
|
|
|
73
7
|
/* Dark, the bare root's mode, as the theme contract has it. */
|
|
74
8
|
:root {
|
|
75
9
|
--crewlet-brand-accent: var(--brand-primary-on-dark, var(--brand-primary));
|
|
10
|
+
/* The ink is text, so it clears 4.5:1: in linear light it is lifted to a
|
|
11
|
+
WCAG luminance of at least 0.265 here, and scaled to at most 0.15 in the
|
|
12
|
+
light blocks below. */
|
|
76
13
|
--crewlet-brand-ink: color(
|
|
77
14
|
from color-mix(in oklab, var(--crewlet-brand-accent) 55%, white) srgb-linear
|
|
78
15
|
calc(r + (1 - r) * max(0, (0.265 - (0.2126 * r + 0.7152 * g + 0.0722 * b)) / (1 - (0.2126 * r + 0.7152 * g + 0.0722 * b))))
|
package/package.json
CHANGED