@multiplatform.one/theme 7.68.0 → 7.69.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@multiplatform.one/theme",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.69.1",
|
|
4
4
|
"description": "Tamagui theme system for multiplatform.one",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"multiplatform",
|
|
@@ -72,8 +72,8 @@
|
|
|
72
72
|
"access": "public"
|
|
73
73
|
},
|
|
74
74
|
"dependencies": {
|
|
75
|
-
"@multiplatform.one/platform": "^7.
|
|
76
|
-
"@multiplatform.one/store": "^7.
|
|
75
|
+
"@multiplatform.one/platform": "^7.69.1",
|
|
76
|
+
"@multiplatform.one/store": "^7.69.1",
|
|
77
77
|
"@tamagui/animations-react-native": "2.7.6",
|
|
78
78
|
"@tamagui/colors": "2.7.6",
|
|
79
79
|
"@tamagui/config": "2.7.6",
|
|
@@ -89,8 +89,8 @@
|
|
|
89
89
|
},
|
|
90
90
|
"devDependencies": {
|
|
91
91
|
"@expo/prebuild-config": "55.0.18",
|
|
92
|
-
"@multiplatform.one/config": "7.
|
|
93
|
-
"@multiplatform.one/test-utils": "7.
|
|
92
|
+
"@multiplatform.one/config": "7.69.1",
|
|
93
|
+
"@multiplatform.one/test-utils": "7.69.1",
|
|
94
94
|
"@tamagui/animations-css": "2.7.6",
|
|
95
95
|
"@tamagui/animations-reanimated": "2.7.6",
|
|
96
96
|
"@tamagui/font-inter": "2.7.6",
|
|
@@ -356,9 +356,23 @@ function holdAccentFloor(
|
|
|
356
356
|
* selection surface ($color4), kept 1.1:1 off both the page and $color4 so it
|
|
357
357
|
* reads as a tint and never as the neutral tier. The ink is the accent step
|
|
358
358
|
* nearest $accentColor that holds 4.5:1 on the tint. Only the scheme roots
|
|
359
|
-
* carry the keys; every child theme inherits them.
|
|
359
|
+
* carry the keys; every child theme inherits them. A grey accent has no hue to
|
|
360
|
+
* say "selected", and a mid-grey ink on a grey tint reads as disabled
|
|
361
|
+
* (FZ-8158), so a grey ramp takes a tint 1.25:1 off $color4 and the ramp's
|
|
362
|
+
* strongest ink.
|
|
360
363
|
*/
|
|
361
364
|
const selectedTintContrastRatio = 1.1;
|
|
365
|
+
const neutralSelectedTintContrastRatio = 1.25;
|
|
366
|
+
const achromaticChannelSpread = 8;
|
|
367
|
+
|
|
368
|
+
function isAchromaticRamp(steps: (string | undefined)[]): boolean {
|
|
369
|
+
return steps.every((step) => {
|
|
370
|
+
const hex = step ? normalizeToHex(step) : null;
|
|
371
|
+
if (!hex) return false;
|
|
372
|
+
const channels = [1, 3, 5].map((offset) => Number.parseInt(hex.slice(offset, offset + 2), 16));
|
|
373
|
+
return Math.max(...channels) - Math.min(...channels) <= achromaticChannelSpread;
|
|
374
|
+
});
|
|
375
|
+
}
|
|
362
376
|
|
|
363
377
|
function holdSelectedState(
|
|
364
378
|
themes: Record<string, Record<string, string>>,
|
|
@@ -383,15 +397,32 @@ function selectedPaint(
|
|
|
383
397
|
const page = luminanceOf(scope.color1);
|
|
384
398
|
const neutral = luminanceOf(scope.color4);
|
|
385
399
|
if (page === null || neutral === null) return undefined;
|
|
400
|
+
const grey = isAchromaticRamp(steps);
|
|
401
|
+
const offNeutral = grey ? neutralSelectedTintContrastRatio : selectedTintContrastRatio;
|
|
386
402
|
const tint = nearestHoldingStep(
|
|
387
403
|
scope.color4,
|
|
388
404
|
steps,
|
|
389
405
|
(lum) =>
|
|
390
406
|
contrastRatio(lum, page) >= selectedTintContrastRatio &&
|
|
391
|
-
contrastRatio(lum, neutral) >=
|
|
407
|
+
contrastRatio(lum, neutral) >= offNeutral,
|
|
392
408
|
);
|
|
393
409
|
const tintLum = luminanceOf(tint);
|
|
394
410
|
if (tint === scope.color4 || tintLum === null) return undefined;
|
|
411
|
+
if (grey) {
|
|
412
|
+
let strongest = tint;
|
|
413
|
+
let strongestRatio = 0;
|
|
414
|
+
for (const step of steps) {
|
|
415
|
+
const lum = luminanceOf(step);
|
|
416
|
+
if (step === undefined || lum === null) continue;
|
|
417
|
+
const ratio = contrastRatio(lum, tintLum);
|
|
418
|
+
if (ratio > strongestRatio) {
|
|
419
|
+
strongest = step;
|
|
420
|
+
strongestRatio = ratio;
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
if (strongestRatio >= aaTextContrastRatio)
|
|
424
|
+
return { selectedBackground: tint, selectedColor: strongest };
|
|
425
|
+
}
|
|
395
426
|
const ink = nearestHoldingStep(
|
|
396
427
|
accentColor,
|
|
397
428
|
steps,
|
|
@@ -124,4 +124,16 @@ describe("LC-131 SELECTED-STATE: one selected recipe in the theme", () => {
|
|
|
124
124
|
expect(ratio(theme.selectedBackground, theme.color1)).toBeGreaterThanOrEqual(1.1);
|
|
125
125
|
}
|
|
126
126
|
});
|
|
127
|
+
|
|
128
|
+
for (const scheme of ["light", "dark"] as const) {
|
|
129
|
+
it(`${scheme}: a grey accent selects with the ramp's strongest ink on a tint 1.25:1 off $color4, never a mid-grey that reads disabled (FZ-8158)`, () => {
|
|
130
|
+
const accent = Array.from({ length: 12 }, (_, i) => paint(scheme, scheme, `accent${i + 1}`));
|
|
131
|
+
const tint = paint(scheme, scheme, "$selectedBackground");
|
|
132
|
+
const ink = paint(scheme, scheme, "$selectedColor");
|
|
133
|
+
expect(ratio(tint, paint(scheme, scheme, "$color4"))).toBeGreaterThanOrEqual(1.25);
|
|
134
|
+
const strongest = Math.max(...accent.map((step) => ratio(step, tint)));
|
|
135
|
+
expect(ratio(ink, tint)).toBe(strongest);
|
|
136
|
+
expect(ratio(ink, tint)).toBeGreaterThanOrEqual(7);
|
|
137
|
+
});
|
|
138
|
+
}
|
|
127
139
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createThemes.d.ts","sourceRoot":"","sources":["../../src/theme/createThemes.ts"],"names":[],"mappings":"AACA,OAAO,EAE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