@olwiba/cn 0.1.29 → 0.1.30
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/package.json +1 -1
- package/src/styles/preset.css +60 -9
package/package.json
CHANGED
package/src/styles/preset.css
CHANGED
|
@@ -22,24 +22,62 @@
|
|
|
22
22
|
:root {
|
|
23
23
|
--radius: 0.25rem;
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
/*
|
|
26
|
+
* Neutral tint — off by default.
|
|
27
|
+
*
|
|
28
|
+
* The light neutrals below are pure achromatic: `oklch(1 0 0)` for the
|
|
29
|
+
* background, chroma 0 on every one of them. That is a deliberate shadcn
|
|
30
|
+
* default and it is fine for a neutral product, but it makes a branded one
|
|
31
|
+
* read as clinical: an accent dropped onto pure white has nothing to sit
|
|
32
|
+
* against, and light mode looks less like "light" than like the absence of
|
|
33
|
+
* colour.
|
|
34
|
+
*
|
|
35
|
+
* Setting these two lets a product tint its neutrals toward its brand hue
|
|
36
|
+
* without restating every token:
|
|
37
|
+
*
|
|
38
|
+
* :root:not(.dark) {
|
|
39
|
+
* --neutral-tint-hue: 186;
|
|
40
|
+
* --neutral-tint-chroma: 0.012;
|
|
41
|
+
* }
|
|
42
|
+
*
|
|
43
|
+
* `:root:not(.dark)`, not `:root` — see the note above the dark block.
|
|
44
|
+
*
|
|
45
|
+
* Chroma is scaled per surface rather than applied flat. A tint that reads
|
|
46
|
+
* as deliberate on a border reads as a colour cast across a full-page
|
|
47
|
+
* background, so the largest surfaces get a fraction of it and the smallest
|
|
48
|
+
* get all of it.
|
|
49
|
+
*
|
|
50
|
+
* Both default to 0, and `oklch(L 0 H)` is achromatic whatever the hue, so
|
|
51
|
+
* a consumer that sets neither renders exactly the colours it did before.
|
|
52
|
+
* The declarations change; the computed values do not.
|
|
53
|
+
*/
|
|
54
|
+
--neutral-tint-hue: 0;
|
|
55
|
+
--neutral-tint-chroma: 0;
|
|
56
|
+
|
|
57
|
+
/* Per-surface share of --neutral-tint-chroma. */
|
|
58
|
+
--neutral-tint-page: calc(var(--neutral-tint-chroma) * 0.33);
|
|
59
|
+
--neutral-tint-raised: calc(var(--neutral-tint-chroma) * 0.25);
|
|
60
|
+
--neutral-tint-muted: calc(var(--neutral-tint-chroma) * 0.67);
|
|
61
|
+
--neutral-tint-line: calc(var(--neutral-tint-chroma) * 0.83);
|
|
62
|
+
|
|
63
|
+
--background: oklch(1 var(--neutral-tint-page) var(--neutral-tint-hue));
|
|
26
64
|
--foreground: oklch(0.145 0 0);
|
|
27
|
-
--card: oklch(1
|
|
65
|
+
--card: oklch(1 var(--neutral-tint-raised) var(--neutral-tint-hue));
|
|
28
66
|
--card-foreground: oklch(0.145 0 0);
|
|
29
|
-
--popover: oklch(1
|
|
67
|
+
--popover: oklch(1 var(--neutral-tint-raised) var(--neutral-tint-hue));
|
|
30
68
|
--popover-foreground: oklch(0.145 0 0);
|
|
31
69
|
|
|
32
70
|
--primary: oklch(0.596 0.145 163.225);
|
|
33
71
|
--primary-foreground: oklch(0.985 0 0);
|
|
34
|
-
--secondary: oklch(0.97
|
|
72
|
+
--secondary: oklch(0.97 var(--neutral-tint-muted) var(--neutral-tint-hue));
|
|
35
73
|
--secondary-foreground: oklch(0.205 0 0);
|
|
36
|
-
--muted: oklch(0.97
|
|
74
|
+
--muted: oklch(0.97 var(--neutral-tint-muted) var(--neutral-tint-hue));
|
|
37
75
|
--muted-foreground: oklch(0.556 0 0);
|
|
38
|
-
--accent: oklch(0.97
|
|
76
|
+
--accent: oklch(0.97 var(--neutral-tint-chroma) var(--neutral-tint-hue));
|
|
39
77
|
--accent-foreground: oklch(0.205 0 0);
|
|
40
78
|
--destructive: oklch(0.577 0.245 27.325);
|
|
41
|
-
--border: oklch(0.922
|
|
42
|
-
--input: oklch(0.922
|
|
79
|
+
--border: oklch(0.922 var(--neutral-tint-line) var(--neutral-tint-hue));
|
|
80
|
+
--input: oklch(0.922 var(--neutral-tint-line) var(--neutral-tint-hue));
|
|
43
81
|
--ring: oklch(0.596 0.145 163.225);
|
|
44
82
|
|
|
45
83
|
--chart-1: oklch(0.765 0.177 163.223);
|
|
@@ -48,7 +86,7 @@
|
|
|
48
86
|
--chart-4: oklch(0.508 0.118 165.612);
|
|
49
87
|
--chart-5: oklch(0.432 0.095 166.913);
|
|
50
88
|
|
|
51
|
-
--sidebar: oklch(0.985
|
|
89
|
+
--sidebar: oklch(0.985 var(--neutral-tint-muted) var(--neutral-tint-hue));
|
|
52
90
|
--sidebar-foreground: oklch(0.145 0 0);
|
|
53
91
|
--sidebar-primary: oklch(0.596 0.145 163.225);
|
|
54
92
|
--sidebar-primary-foreground: oklch(0.985 0 0);
|
|
@@ -58,6 +96,19 @@
|
|
|
58
96
|
--sidebar-ring: oklch(0.596 0.145 163.225);
|
|
59
97
|
}
|
|
60
98
|
|
|
99
|
+
/*
|
|
100
|
+
* Overriding any of these from a consumer stylesheet needs `:root:not(.dark)`,
|
|
101
|
+
* not `:root`.
|
|
102
|
+
*
|
|
103
|
+
* `.dark` is a class and `:root` is a pseudo-class — the same specificity. A
|
|
104
|
+
* consumer's stylesheet is imported after this preset, so a plain `:root`
|
|
105
|
+
* block wins on source order and repaints *dark* mode with the light values.
|
|
106
|
+
* It looks like the override was ignored in light mode and applied in dark,
|
|
107
|
+
* which sends you looking in the wrong place entirely.
|
|
108
|
+
*
|
|
109
|
+
* The neutral tint knobs above exist partly to avoid needing such an override
|
|
110
|
+
* at all.
|
|
111
|
+
*/
|
|
61
112
|
.dark {
|
|
62
113
|
--background: oklch(0.145 0 0);
|
|
63
114
|
--foreground: oklch(0.985 0 0);
|