@olwiba/cn 0.1.30 → 0.1.32

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@olwiba/cn",
3
- "version": "0.1.30",
3
+ "version": "0.1.32",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -47,37 +47,74 @@
47
47
  * background, so the largest surfaces get a fraction of it and the smallest
48
48
  * get all of it.
49
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.
50
+ * Both tint knobs default to 0, and `oklch(L 0 H)` is achromatic whatever
51
+ * the hue, so a consumer that sets neither gets no colour at all.
52
+ *
53
+ * `--neutral-lift` below is the exception: it has a non-zero default,
54
+ * because pure white is worth refusing by default rather than opting out
55
+ * of. That is the only value a consumer inherits without asking.
53
56
  */
54
57
  --neutral-tint-hue: 0;
55
58
  --neutral-tint-chroma: 0;
56
59
 
60
+ /*
61
+ * How far the page drops below pure white. Also 0 by default.
62
+ *
63
+ * Chroma alone is not enough. `oklch(1 0.004 186)` is still white — there is
64
+ * almost no room for colour at maximum lightness — so a tint applied to a
65
+ * pure-white background barely registers, and "light mode is too bright"
66
+ * stays true. Lowering the page a little is what makes the tint visible and
67
+ * the page comfortable.
68
+ *
69
+ * It also separates card from background, which are otherwise the identical
70
+ * value: a card is distinguished from the page only by its border, and a
71
+ * translucent surface over it (`bg-card/45`) shows nothing at all. The card
72
+ * drops by a fifth of what the page does, so it lifts without becoming a
73
+ * different colour.
74
+ *
75
+ * Foregrounds are untouched, and the largest move here is 1 → 0.985, so
76
+ * contrast is effectively unchanged.
77
+ *
78
+ * The default is not 0. Pure white is the one value worth refusing outright:
79
+ * it emits more light than any other surface on the screen, which is why
80
+ * long reading sessions tire eyes faster on #ffffff than on an off-white,
81
+ * and it flattens a page into something sterile. The convention in
82
+ * editorial and product design is to sit just off it.
83
+ *
84
+ * 0.003 puts the page at #fefefe — one step per channel, deliberately
85
+ * conservative. It removes the extreme without restyling any consumer's
86
+ * product, and it is the floor rather than the recommendation: 0.015
87
+ * (#fafafa) is where the glare actually goes, and is what nestrrr uses.
88
+ *
89
+ * `--neutral-lift: 0` still gets pure white back for anything that wants
90
+ * it — a print stylesheet, a canvas, a screenshot surface.
91
+ */
92
+ --neutral-lift: 0.003;
93
+
57
94
  /* Per-surface share of --neutral-tint-chroma. */
58
95
  --neutral-tint-page: calc(var(--neutral-tint-chroma) * 0.33);
59
96
  --neutral-tint-raised: calc(var(--neutral-tint-chroma) * 0.25);
60
97
  --neutral-tint-muted: calc(var(--neutral-tint-chroma) * 0.67);
61
98
  --neutral-tint-line: calc(var(--neutral-tint-chroma) * 0.83);
62
99
 
63
- --background: oklch(1 var(--neutral-tint-page) var(--neutral-tint-hue));
100
+ --background: oklch(calc(1 - var(--neutral-lift)) var(--neutral-tint-page) var(--neutral-tint-hue));
64
101
  --foreground: oklch(0.145 0 0);
65
- --card: oklch(1 var(--neutral-tint-raised) var(--neutral-tint-hue));
102
+ --card: oklch(calc(1 - var(--neutral-lift) * 0.2) var(--neutral-tint-raised) var(--neutral-tint-hue));
66
103
  --card-foreground: oklch(0.145 0 0);
67
- --popover: oklch(1 var(--neutral-tint-raised) var(--neutral-tint-hue));
104
+ --popover: oklch(calc(1 - var(--neutral-lift) * 0.2) var(--neutral-tint-raised) var(--neutral-tint-hue));
68
105
  --popover-foreground: oklch(0.145 0 0);
69
106
 
70
107
  --primary: oklch(0.596 0.145 163.225);
71
108
  --primary-foreground: oklch(0.985 0 0);
72
- --secondary: oklch(0.97 var(--neutral-tint-muted) var(--neutral-tint-hue));
109
+ --secondary: oklch(calc(0.97 - var(--neutral-lift) * 0.53) var(--neutral-tint-muted) var(--neutral-tint-hue));
73
110
  --secondary-foreground: oklch(0.205 0 0);
74
- --muted: oklch(0.97 var(--neutral-tint-muted) var(--neutral-tint-hue));
111
+ --muted: oklch(calc(0.97 - var(--neutral-lift) * 0.53) var(--neutral-tint-muted) var(--neutral-tint-hue));
75
112
  --muted-foreground: oklch(0.556 0 0);
76
- --accent: oklch(0.97 var(--neutral-tint-chroma) var(--neutral-tint-hue));
113
+ --accent: oklch(calc(0.97 - var(--neutral-lift)) var(--neutral-tint-chroma) var(--neutral-tint-hue));
77
114
  --accent-foreground: oklch(0.205 0 0);
78
115
  --destructive: oklch(0.577 0.245 27.325);
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));
116
+ --border: oklch(calc(0.922 - var(--neutral-lift) * 0.67) var(--neutral-tint-line) var(--neutral-tint-hue));
117
+ --input: oklch(calc(0.922 - var(--neutral-lift) * 0.67) var(--neutral-tint-line) var(--neutral-tint-hue));
81
118
  --ring: oklch(0.596 0.145 163.225);
82
119
 
83
120
  --chart-1: oklch(0.765 0.177 163.223);
@@ -86,13 +123,13 @@
86
123
  --chart-4: oklch(0.508 0.118 165.612);
87
124
  --chart-5: oklch(0.432 0.095 166.913);
88
125
 
89
- --sidebar: oklch(0.985 var(--neutral-tint-muted) var(--neutral-tint-hue));
126
+ --sidebar: oklch(calc(0.985 - var(--neutral-lift) * 0.67) var(--neutral-tint-muted) var(--neutral-tint-hue));
90
127
  --sidebar-foreground: oklch(0.145 0 0);
91
128
  --sidebar-primary: oklch(0.596 0.145 163.225);
92
129
  --sidebar-primary-foreground: oklch(0.985 0 0);
93
- --sidebar-accent: oklch(0.97 0 0);
130
+ --sidebar-accent: oklch(calc(0.97 - var(--neutral-lift)) var(--neutral-tint-chroma) var(--neutral-tint-hue));
94
131
  --sidebar-accent-foreground: oklch(0.205 0 0);
95
- --sidebar-border: oklch(0.922 0 0);
132
+ --sidebar-border: oklch(calc(0.922 - var(--neutral-lift) * 0.67) var(--neutral-tint-line) var(--neutral-tint-hue));
96
133
  --sidebar-ring: oklch(0.596 0.145 163.225);
97
134
  }
98
135