@multiplatform.one/theme 7.88.6 → 7.88.7
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/cjs/theme/accentInk.cjs +122 -0
- package/dist/cjs/theme/accentInk.native.js +200 -0
- package/dist/cjs/theme/accentInk.native.js.map +1 -0
- package/dist/cjs/theme/createThemes.cjs +7 -6
- package/dist/cjs/theme/createThemes.native.js +7 -6
- package/dist/cjs/theme/createThemes.native.js.map +1 -1
- package/dist/cjs/theme/readableColor.cjs +11 -77
- package/dist/cjs/theme/readableColor.native.js +13 -148
- package/dist/cjs/theme/readableColor.native.js.map +1 -1
- package/dist/cjs/theme/tintHues.cjs +28 -0
- package/dist/cjs/theme/tintHues.native.js +31 -0
- package/dist/cjs/theme/tintHues.native.js.map +1 -0
- package/dist/esm/theme/accentInk.mjs +91 -0
- package/dist/esm/theme/accentInk.mjs.map +1 -0
- package/dist/esm/theme/accentInk.native.js +166 -0
- package/dist/esm/theme/accentInk.native.js.map +1 -0
- package/dist/esm/theme/createThemes.mjs +5 -4
- package/dist/esm/theme/createThemes.mjs.map +1 -1
- package/dist/esm/theme/createThemes.native.js +5 -4
- package/dist/esm/theme/createThemes.native.js.map +1 -1
- package/dist/esm/theme/readableColor.mjs +6 -72
- package/dist/esm/theme/readableColor.mjs.map +1 -1
- package/dist/esm/theme/readableColor.native.js +7 -142
- package/dist/esm/theme/readableColor.native.js.map +1 -1
- package/dist/esm/theme/tintHues.mjs +3 -0
- package/dist/esm/theme/tintHues.mjs.map +1 -0
- package/dist/esm/theme/tintHues.native.js +3 -0
- package/dist/esm/theme/tintHues.native.js.map +1 -0
- package/package.json +5 -5
- package/src/theme/accentInk.ts +134 -0
- package/src/theme/accentOnSurface.flip.spec.tsx +155 -0
- package/src/theme/accentOnSurface.palette.spec.tsx +2 -1
- package/src/theme/accentOnSurface.spec.tsx +2 -1
- package/src/theme/createDefaultThemeConfig.spec.ts +2 -2
- package/src/theme/createThemes.ts +21 -47
- package/src/theme/readableColor.ts +15 -100
- package/src/theme/tintHues.ts +36 -0
- package/types/theme/accentInk.d.ts +34 -0
- package/types/theme/accentInk.d.ts.map +1 -0
- package/types/theme/createThemes.d.ts +2 -1
- package/types/theme/createThemes.d.ts.map +1 -1
- package/types/theme/readableColor.d.ts +2 -21
- package/types/theme/readableColor.d.ts.map +1 -1
- package/types/theme/tintHues.d.ts +2 -0
- package/types/theme/tintHues.d.ts.map +1 -0
|
@@ -60,7 +60,8 @@ interface Seen {
|
|
|
60
60
|
function Probe({ seen }: { seen: Seen }) {
|
|
61
61
|
const theme = useTheme() as unknown as Record<string, { val?: string } | undefined>;
|
|
62
62
|
seen.name = useThemeName();
|
|
63
|
-
|
|
63
|
+
const accent = useAccentOnSurface();
|
|
64
|
+
seen.accent = accent.startsWith("$") ? (theme[accent.slice(1)]?.val ?? accent) : accent;
|
|
64
65
|
seen.identity = useIdentityInkOnSurface();
|
|
65
66
|
seen.surfaces = [theme.color1?.val ?? "", theme.color2?.val ?? ""];
|
|
66
67
|
seen.accentSteps = Array.from({ length: 12 }, (_, i) => theme[`accent${i + 1}`]?.val ?? "");
|
|
@@ -452,10 +452,10 @@ describe("the v5 theme matrix", () => {
|
|
|
452
452
|
// `theme="accent"` follows a picked colour; the budget moved 260 -> 280 KB.
|
|
453
453
|
// FZ-7970 (LC-160) dedupes values another rule already puts on the element:
|
|
454
454
|
// 280,833 -> 263,241 bytes, and the budget ratchets down to 264 KB.
|
|
455
|
-
it("ships 478 themes and the heading-scope category fonts in under
|
|
455
|
+
it("ships 478 themes and the heading-scope category fonts in under 265 KB of CSS (the v4 matrix and stock spread shipped 913 KB)", async () => {
|
|
456
456
|
const { createTamagui: build } = await vi.importActual<typeof import("tamagui")>("tamagui");
|
|
457
457
|
const css = build(config.tamagui).getCSS();
|
|
458
458
|
expect(Object.keys(themes)).toHaveLength(478);
|
|
459
|
-
expect(Buffer.byteLength(css, "utf8")).toBeLessThan(
|
|
459
|
+
expect(Buffer.byteLength(css, "utf8")).toBeLessThan(265_000);
|
|
460
460
|
});
|
|
461
461
|
});
|
|
@@ -23,6 +23,10 @@ import {
|
|
|
23
23
|
} from "./colorRules";
|
|
24
24
|
import { pickSecondaryInk } from "./defaults/builderOptions";
|
|
25
25
|
import { themeRampHues } from "./ramps";
|
|
26
|
+
import { withAccentOnSurface } from "./accentInk";
|
|
27
|
+
import { tintHueNames } from "./tintHues";
|
|
28
|
+
|
|
29
|
+
export { tintHueNames };
|
|
26
30
|
|
|
27
31
|
/**
|
|
28
32
|
* MPO-40. Radix step 11 targets its own surface, but intent ink also paints on
|
|
@@ -168,43 +172,6 @@ function sanitizeGetTheme(
|
|
|
168
172
|
};
|
|
169
173
|
}
|
|
170
174
|
|
|
171
|
-
// Radix hue names whose sub-themes act as decorative TINTS (Tint.tsx cycling,
|
|
172
|
-
// the storybook `color` global). Under a tint,
|
|
173
|
-
// surfaces/borders/solids keep the hue but TEXT must stay readable neutral:
|
|
174
|
-
// muted/secondary text and user-authored content must never render saturated
|
|
175
|
-
// accent (SB-D-14/SB-D-20). Exported so theme-identity consumers (chart
|
|
176
|
-
// palette) share the one tint registry.
|
|
177
|
-
export const tintHueNames = new Set([
|
|
178
|
-
"amber",
|
|
179
|
-
"blue",
|
|
180
|
-
"bronze",
|
|
181
|
-
"brown",
|
|
182
|
-
"crimson",
|
|
183
|
-
"cyan",
|
|
184
|
-
"gold",
|
|
185
|
-
"grass",
|
|
186
|
-
"gray",
|
|
187
|
-
"green",
|
|
188
|
-
"indigo",
|
|
189
|
-
"lime",
|
|
190
|
-
"mauve",
|
|
191
|
-
"mint",
|
|
192
|
-
"olive",
|
|
193
|
-
"orange",
|
|
194
|
-
"pink",
|
|
195
|
-
"plum",
|
|
196
|
-
"purple",
|
|
197
|
-
"red",
|
|
198
|
-
"sage",
|
|
199
|
-
"sand",
|
|
200
|
-
"sky",
|
|
201
|
-
"slate",
|
|
202
|
-
"teal",
|
|
203
|
-
"tomato",
|
|
204
|
-
"violet",
|
|
205
|
-
"yellow",
|
|
206
|
-
]);
|
|
207
|
-
|
|
208
175
|
// Text-tier tokens re-anchored to the neutral scheme ramp inside tint themes.
|
|
209
176
|
const tintNeutralTextKeys = [
|
|
210
177
|
"color",
|
|
@@ -1032,14 +999,18 @@ export function createThemesBuilder(
|
|
|
1032
999
|
const initialTheme = tamaguiCreateThemes(
|
|
1033
1000
|
createThemesProps as Parameters<typeof tamaguiCreateThemes>[0],
|
|
1034
1001
|
);
|
|
1035
|
-
const themes =
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1002
|
+
const themes = withAccentOnSurface(
|
|
1003
|
+
holdFocusRingAccent(
|
|
1004
|
+
holdColorThemeAccent(
|
|
1005
|
+
holdSwitchTrack(
|
|
1006
|
+
holdSyntaxFloor(
|
|
1007
|
+
holdNamedInkFloor(
|
|
1008
|
+
holdSelectedState(
|
|
1009
|
+
holdAccentFloor(
|
|
1010
|
+
holdSelectionSurface(
|
|
1011
|
+
neutralizeSemanticEntryText(neutralizeTintText(initialTheme)),
|
|
1012
|
+
),
|
|
1013
|
+
),
|
|
1043
1014
|
),
|
|
1044
1015
|
),
|
|
1045
1016
|
),
|
|
@@ -1071,10 +1042,13 @@ export function createThemesBuilder(
|
|
|
1071
1042
|
const createdTheme = tamaguiCreateThemes(
|
|
1072
1043
|
addThemeProps as Parameters<typeof tamaguiCreateThemes>[0],
|
|
1073
1044
|
);
|
|
1074
|
-
return {
|
|
1045
|
+
return withAccentOnSurface({
|
|
1075
1046
|
[`dark_${name}`]: createdTheme.dark_accent,
|
|
1076
1047
|
[`light_${name}`]: createdTheme.light_accent,
|
|
1077
|
-
} as Record
|
|
1048
|
+
} as Record<string, Record<string, string>>) as Record<
|
|
1049
|
+
`dark_${K}` | `light_${K}`,
|
|
1050
|
+
typeof createdTheme.dark_accent
|
|
1051
|
+
>;
|
|
1078
1052
|
},
|
|
1079
1053
|
};
|
|
1080
1054
|
}
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import { useMemo } from "react";
|
|
2
|
-
import { useTheme as useTamaguiTheme, useThemeName } from "tamagui";
|
|
2
|
+
import { isWeb, useTheme as useTamaguiTheme, useThemeName } from "tamagui";
|
|
3
|
+
import {
|
|
4
|
+
accentStepKeys,
|
|
5
|
+
chromaOf,
|
|
6
|
+
identityKeys,
|
|
7
|
+
pickIdentityInk,
|
|
8
|
+
resolveAccentOnSurface,
|
|
9
|
+
resolveIdentityInk,
|
|
10
|
+
} from "./accentInk";
|
|
3
11
|
import {
|
|
4
12
|
aaTextContrastRatio,
|
|
5
13
|
contrastRatio,
|
|
@@ -10,7 +18,8 @@ import {
|
|
|
10
18
|
relativeLuminance,
|
|
11
19
|
} from "./colorRules";
|
|
12
20
|
import { isDarkThemeName } from "./controlTiers";
|
|
13
|
-
|
|
21
|
+
|
|
22
|
+
export { resolveAccentOnSurface, resolveIdentityInk };
|
|
14
23
|
|
|
15
24
|
/**
|
|
16
25
|
* Live-theme contrast helpers for text on solids and accent ink on surfaces.
|
|
@@ -99,100 +108,6 @@ export function useLegibleInkOn(fill_: string | undefined, preferred: string): s
|
|
|
99
108
|
}, [fill, preferred, preferredValue, paper, ink]);
|
|
100
109
|
}
|
|
101
110
|
|
|
102
|
-
/** Below this sRGB chroma a step reads as grey, not as a hue. */
|
|
103
|
-
const IDENTITY_CHROMA_FLOOR = 0.1;
|
|
104
|
-
|
|
105
|
-
function chromaOf(hex: string): number {
|
|
106
|
-
const rgb = [1, 3, 5].map((offset) => parseInt(hex.slice(offset, offset + 2), 16) / 255);
|
|
107
|
-
return Math.max(...rgb) - Math.min(...rgb);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
function surfaceLuminances(surfaces: readonly (string | undefined)[]): number[] | null {
|
|
111
|
-
const lums: number[] = [];
|
|
112
|
-
for (const surface of surfaces) {
|
|
113
|
-
const hex = surface ? normalizeToHex(surface) : null;
|
|
114
|
-
if (!hex) return null;
|
|
115
|
-
lums.push(relativeLuminance(hex));
|
|
116
|
-
}
|
|
117
|
-
return lums;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
function pickIdentityInk(
|
|
121
|
-
candidates: readonly (string | undefined)[],
|
|
122
|
-
surfaces: readonly (string | undefined)[],
|
|
123
|
-
): string | undefined {
|
|
124
|
-
const surfaceLums = surfaceLuminances(surfaces);
|
|
125
|
-
if (!surfaceLums) return undefined;
|
|
126
|
-
let best: string | undefined;
|
|
127
|
-
let bestChroma = IDENTITY_CHROMA_FLOOR;
|
|
128
|
-
for (const candidate of candidates) {
|
|
129
|
-
const hex = candidate ? normalizeToHex(candidate) : null;
|
|
130
|
-
if (!candidate || !hex) continue;
|
|
131
|
-
const lum = relativeLuminance(hex);
|
|
132
|
-
if (surfaceLums.some((surface) => contrastRatio(lum, surface) < aaTextContrastRatio)) continue;
|
|
133
|
-
const chroma = chromaOf(hex);
|
|
134
|
-
if (chroma > bestChroma) {
|
|
135
|
-
bestChroma = chroma;
|
|
136
|
-
best = candidate;
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
return best;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
/**
|
|
143
|
-
* Pure resolver behind {@link useIdentityInkOnSurface}: the most chromatic
|
|
144
|
-
* candidate that clears AA text contrast on every surface, else `ink`.
|
|
145
|
-
*/
|
|
146
|
-
export function resolveIdentityInk({
|
|
147
|
-
candidates,
|
|
148
|
-
surfaces,
|
|
149
|
-
ink,
|
|
150
|
-
}: {
|
|
151
|
-
candidates: readonly (string | undefined)[];
|
|
152
|
-
surfaces: readonly (string | undefined)[];
|
|
153
|
-
ink: string;
|
|
154
|
-
}): string {
|
|
155
|
-
return pickIdentityInk(candidates, surfaces) ?? ink;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
/**
|
|
159
|
-
* Pure resolver behind {@link useAccentOnSurface}. The identity hue first
|
|
160
|
-
* (`identity`, see {@link useIdentityInkOnSurface}), so a colour theme's
|
|
161
|
-
* accent ink is that colour. With no hue, the accent ramp's least-contrast
|
|
162
|
-
* step that still clears AA on every surface, else `ink`.
|
|
163
|
-
*/
|
|
164
|
-
export function resolveAccentOnSurface({
|
|
165
|
-
identity,
|
|
166
|
-
accentSteps,
|
|
167
|
-
surfaces,
|
|
168
|
-
ink,
|
|
169
|
-
}: {
|
|
170
|
-
identity: readonly (string | undefined)[];
|
|
171
|
-
accentSteps: readonly (string | undefined)[];
|
|
172
|
-
surfaces: readonly (string | undefined)[];
|
|
173
|
-
ink: string;
|
|
174
|
-
}): string {
|
|
175
|
-
const hued = pickIdentityInk(identity, surfaces);
|
|
176
|
-
if (hued) return hued;
|
|
177
|
-
const surfaceLums = surfaceLuminances(surfaces);
|
|
178
|
-
if (!surfaceLums) return ink;
|
|
179
|
-
let best: string | undefined;
|
|
180
|
-
let bestMin = Number.POSITIVE_INFINITY;
|
|
181
|
-
for (const step of accentSteps) {
|
|
182
|
-
const hex = step ? normalizeToHex(step) : null;
|
|
183
|
-
if (!step || !hex) continue;
|
|
184
|
-
const stepLum = relativeLuminance(hex);
|
|
185
|
-
const min = Math.min(...surfaceLums.map((surface) => contrastRatio(stepLum, surface)));
|
|
186
|
-
if (min >= aaTextContrastRatio && min < bestMin) {
|
|
187
|
-
bestMin = min;
|
|
188
|
-
best = step;
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
return best ?? ink;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
const accentStepKeys = Array.from({ length: 12 }, (_, index) => `accent${index + 1}`);
|
|
195
|
-
|
|
196
111
|
/**
|
|
197
112
|
* The live theme's identity candidates and page surfaces. Under a tint
|
|
198
113
|
* (`dark_orange`) the hue is the tint's own ramp, whose text tiers the build
|
|
@@ -202,9 +117,7 @@ const accentStepKeys = Array.from({ length: 12 }, (_, index) => `accent${index +
|
|
|
202
117
|
function useIdentityInputs() {
|
|
203
118
|
const themeName = (useThemeName() as string | undefined) ?? "";
|
|
204
119
|
const theme = useTamaguiTheme() as unknown as Record<string, { val?: unknown } | undefined>;
|
|
205
|
-
const
|
|
206
|
-
const isTint = hue !== undefined && tintHueNames.has(hue as never);
|
|
207
|
-
const keys = isTint ? ["color8", "color9", "color10", `${hue}11`, `${hue}12`] : accentStepKeys;
|
|
120
|
+
const keys = identityKeys(themeName);
|
|
208
121
|
return {
|
|
209
122
|
candidates: keys.map((key) => resolveTokenValue(theme, key)),
|
|
210
123
|
accentSteps: accentStepKeys.map((key) => resolveTokenValue(theme, key)),
|
|
@@ -226,13 +139,15 @@ function useIdentityInputs() {
|
|
|
226
139
|
*/
|
|
227
140
|
export function useAccentOnSurface(): string {
|
|
228
141
|
const { candidates, accentSteps, c1, c2, ink } = useIdentityInputs();
|
|
142
|
+
const theme = useTamaguiTheme() as unknown as Record<string, { val?: unknown } | undefined>;
|
|
229
143
|
const candidateKey = candidates.join("|");
|
|
230
144
|
const stepKey = accentSteps.join("|");
|
|
231
|
-
|
|
145
|
+
const picked = useMemo(
|
|
232
146
|
() => resolveAccentOnSurface({ identity: candidates, accentSteps, surfaces: [c1, c2], ink }),
|
|
233
147
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
234
148
|
[candidateKey, stepKey, c1, c2, ink],
|
|
235
149
|
);
|
|
150
|
+
return isWeb && theme.accentOnSurface?.val === picked ? "$accentOnSurface" : picked;
|
|
236
151
|
}
|
|
237
152
|
|
|
238
153
|
/**
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// Radix hue names whose sub-themes act as decorative TINTS (Tint.tsx cycling,
|
|
2
|
+
// the storybook `color` global). Under a tint,
|
|
3
|
+
// surfaces/borders/solids keep the hue but TEXT must stay readable neutral:
|
|
4
|
+
// muted/secondary text and user-authored content must never render saturated
|
|
5
|
+
// accent (SB-D-14/SB-D-20). Exported so theme-identity consumers (chart
|
|
6
|
+
// palette) share the one tint registry.
|
|
7
|
+
export const tintHueNames = new Set([
|
|
8
|
+
"amber",
|
|
9
|
+
"blue",
|
|
10
|
+
"bronze",
|
|
11
|
+
"brown",
|
|
12
|
+
"crimson",
|
|
13
|
+
"cyan",
|
|
14
|
+
"gold",
|
|
15
|
+
"grass",
|
|
16
|
+
"gray",
|
|
17
|
+
"green",
|
|
18
|
+
"indigo",
|
|
19
|
+
"lime",
|
|
20
|
+
"mauve",
|
|
21
|
+
"mint",
|
|
22
|
+
"olive",
|
|
23
|
+
"orange",
|
|
24
|
+
"pink",
|
|
25
|
+
"plum",
|
|
26
|
+
"purple",
|
|
27
|
+
"red",
|
|
28
|
+
"sage",
|
|
29
|
+
"sand",
|
|
30
|
+
"sky",
|
|
31
|
+
"slate",
|
|
32
|
+
"teal",
|
|
33
|
+
"tomato",
|
|
34
|
+
"violet",
|
|
35
|
+
"yellow",
|
|
36
|
+
]);
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export declare function chromaOf(hex: string): number;
|
|
2
|
+
export declare function pickIdentityInk(candidates: readonly (string | undefined)[], surfaces: readonly (string | undefined)[]): string | undefined;
|
|
3
|
+
/**
|
|
4
|
+
* Pure resolver behind {@link useIdentityInkOnSurface}: the most chromatic
|
|
5
|
+
* candidate that clears AA text contrast on every surface, else `ink`.
|
|
6
|
+
*/
|
|
7
|
+
export declare function resolveIdentityInk({ candidates, surfaces, ink, }: {
|
|
8
|
+
candidates: readonly (string | undefined)[];
|
|
9
|
+
surfaces: readonly (string | undefined)[];
|
|
10
|
+
ink: string;
|
|
11
|
+
}): string;
|
|
12
|
+
/**
|
|
13
|
+
* Pure resolver behind {@link useAccentOnSurface}. The identity hue first
|
|
14
|
+
* (`identity`, see {@link useIdentityInkOnSurface}), so a colour theme's
|
|
15
|
+
* accent ink is that colour. With no hue, the accent ramp's least-contrast
|
|
16
|
+
* step that still clears AA on every surface, else `ink`.
|
|
17
|
+
*/
|
|
18
|
+
export declare function resolveAccentOnSurface({ identity, accentSteps, surfaces, ink, }: {
|
|
19
|
+
identity: readonly (string | undefined)[];
|
|
20
|
+
accentSteps: readonly (string | undefined)[];
|
|
21
|
+
surfaces: readonly (string | undefined)[];
|
|
22
|
+
ink: string;
|
|
23
|
+
}): string;
|
|
24
|
+
export declare const accentStepKeys: string[];
|
|
25
|
+
/** The identity candidates' keys for `themeName`: a tint's own ramp, else the accent ramp. */
|
|
26
|
+
export declare function identityKeys(themeName: string): string[];
|
|
27
|
+
/**
|
|
28
|
+
* FZ-9608. Every theme with the ink {@link useAccentOnSurface} picks inside it,
|
|
29
|
+
* as `accentOnSurface`. On web the hook then hands back `$accentOnSurface`, so
|
|
30
|
+
* consumers paint a CSS variable that follows a light/dark flip with no
|
|
31
|
+
* re-render. A picked literal stayed on the scheme it was picked in.
|
|
32
|
+
*/
|
|
33
|
+
export declare function withAccentOnSurface(themes: Record<string, Record<string, string>>): Record<string, Record<string, string>>;
|
|
34
|
+
//# sourceMappingURL=accentInk.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accentInk.d.ts","sourceRoot":"","sources":["../../src/theme/accentInk.ts"],"names":[],"mappings":"AAYA,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAG5C;AAYD,wBAAgB,eAAe,CAC7B,UAAU,EAAE,SAAS,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,EAC3C,QAAQ,EAAE,SAAS,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,GACxC,MAAM,GAAG,SAAS,CAiBpB;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,UAAU,EACV,QAAQ,EACR,GAAG,GACJ,EAAE;IACD,UAAU,EAAE,SAAS,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,CAAC;IAC5C,QAAQ,EAAE,SAAS,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,CAAC;IAC1C,GAAG,EAAE,MAAM,CAAC;CACb,GAAG,MAAM,CAET;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,EACrC,QAAQ,EACR,WAAW,EACX,QAAQ,EACR,GAAG,GACJ,EAAE;IACD,QAAQ,EAAE,SAAS,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,CAAC;IAC1C,WAAW,EAAE,SAAS,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,CAAC;IAC7C,QAAQ,EAAE,SAAS,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,CAAC;IAC1C,GAAG,EAAE,MAAM,CAAC;CACb,GAAG,MAAM,CAkBT;AAED,eAAO,MAAM,cAAc,UAAiE,CAAC;AAE7F,8FAA8F;AAC9F,wBAAgB,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,CAKxD;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GAC7C,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAcxC"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { createThemes as tamaguiCreateThemes } from "@tamagui/theme-builder";
|
|
2
|
+
import { tintHueNames } from "./tintHues";
|
|
3
|
+
export { tintHueNames };
|
|
2
4
|
export declare const houseTemplates: {
|
|
3
5
|
light_surface1: {
|
|
4
6
|
background: number;
|
|
@@ -496,7 +498,6 @@ export interface CreateThemesBuilderOptions {
|
|
|
496
498
|
grandChildrenThemes?: Parameters<typeof tamaguiCreateThemes>[0]["grandChildrenThemes"];
|
|
497
499
|
getTheme?: (props: GetThemeProps) => Record<string, string | number | null | undefined>;
|
|
498
500
|
}
|
|
499
|
-
export declare const tintHueNames: Set<string>;
|
|
500
501
|
export declare function createThemesBuilder(baseTheme: BaseThemeBuilderDefinition, accentTheme: ThemeBuilderDefinition, options?: CreateThemesBuilderOptions): {
|
|
501
502
|
themes(): Record<string, Record<string, string>>;
|
|
502
503
|
addTheme<K extends string>(name: K, theme: ThemeBuilderDefinition): Record<`dark_${K}` | `light_${K}`, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createThemes.d.ts","sourceRoot":"","sources":["../../src/theme/createThemes.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,YAAY,IAAI,mBAAmB,EACpC,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"createThemes.d.ts","sourceRoot":"","sources":["../../src/theme/createThemes.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,YAAY,IAAI,mBAAmB,EACpC,MAAM,wBAAwB,CAAC;AAsBhC,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE1C,OAAO,EAAE,YAAY,EAAE,CAAC;AAqDxB,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAG1B,CAAC;AAEF,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAevB,CAAC;AAEX,eAAO,MAAM,wBAAwB;;;;;;;;;;CAI3B,CAAC;AAEX,MAAM,WAAW,OAAO;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,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M,GAAG,IAAI,GAAG,SAAS,CAAC,CAAC;CACzF;AA8wBD,wBAAgB,mBAAmB,CACjC,SAAS,EAAE,0BAA0B,EACrC,WAAW,EAAE,sBAAsB,EACnC,OAAO,CAAC,EAAE,0BAA0B;;aAyFzB,CAAC,SAAS,MAAM,QAAQ,CAAC,SAAS,sBAAsB,GAuBf,MAAM,CACpD,QAAQ,CAAC,EAAE,GAAG,SAAS,CAAC,EAAE;;+BAE3B;EAGN"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { resolveAccentOnSurface, resolveIdentityInk } from "./accentInk";
|
|
2
|
+
export { resolveAccentOnSurface, resolveIdentityInk };
|
|
1
3
|
/**
|
|
2
4
|
* Readable text/glyph color to sit ON `fill` (a token like "$color8" or a
|
|
3
5
|
* resolved value, such as the wash from `useAccentTintedSurface`): the
|
|
@@ -27,27 +29,6 @@ export declare function resolveLegibleInkOn({ fill, preferred, paper, ink, }: {
|
|
|
27
29
|
* its exact paint; a replacement comes back as a concrete color.
|
|
28
30
|
*/
|
|
29
31
|
export declare function useLegibleInkOn(fill_: string | undefined, preferred: string): string;
|
|
30
|
-
/**
|
|
31
|
-
* Pure resolver behind {@link useIdentityInkOnSurface}: the most chromatic
|
|
32
|
-
* candidate that clears AA text contrast on every surface, else `ink`.
|
|
33
|
-
*/
|
|
34
|
-
export declare function resolveIdentityInk({ candidates, surfaces, ink, }: {
|
|
35
|
-
candidates: readonly (string | undefined)[];
|
|
36
|
-
surfaces: readonly (string | undefined)[];
|
|
37
|
-
ink: string;
|
|
38
|
-
}): string;
|
|
39
|
-
/**
|
|
40
|
-
* Pure resolver behind {@link useAccentOnSurface}. The identity hue first
|
|
41
|
-
* (`identity`, see {@link useIdentityInkOnSurface}), so a colour theme's
|
|
42
|
-
* accent ink is that colour. With no hue, the accent ramp's least-contrast
|
|
43
|
-
* step that still clears AA on every surface, else `ink`.
|
|
44
|
-
*/
|
|
45
|
-
export declare function resolveAccentOnSurface({ identity, accentSteps, surfaces, ink, }: {
|
|
46
|
-
identity: readonly (string | undefined)[];
|
|
47
|
-
accentSteps: readonly (string | undefined)[];
|
|
48
|
-
surfaces: readonly (string | undefined)[];
|
|
49
|
-
ink: string;
|
|
50
|
-
}): string;
|
|
51
32
|
/**
|
|
52
33
|
* Accent-hued text/link ink readable on the page surfaces (color1/color2),
|
|
53
34
|
* shared by links, Toast, DatePicker, table filters, Button and every other
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"readableColor.d.ts","sourceRoot":"","sources":["../../src/theme/readableColor.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"readableColor.d.ts","sourceRoot":"","sources":["../../src/theme/readableColor.ts"],"names":[],"mappings":"AAEA,OAAO,EAKL,sBAAsB,EACtB,kBAAkB,EACnB,MAAM,aAAa,CAAC;AAYrB,OAAO,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,CAAC;AAiBtD;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAU/E;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,IAAI,EACJ,SAAS,EACT,KAAK,EACL,GAAG,GACJ,EAAE;IACD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,GAAG,MAAM,GAAG,SAAS,CAarB;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAYpF;AAqBD;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,IAAI,MAAM,CAW3C;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,IAAI,MAAM,CAQhD;AAED;;;;GAIG;AACH,wBAAgB,cAAc,IAAI;IAChC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