@multiplatform.one/theme 7.34.4 → 7.35.0
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 +20 -5
- package/src/audit/constraintAudit.spec.ts +274 -87
- package/src/audit/constraintAudit.ts +135 -120
- package/src/audit/constraintScope.spec.ts +1 -1
- package/src/audit/designTokens.ts +42 -0
- package/src/audit/themeMatrix.spec.ts +83 -2
- package/src/audit/themeMatrix.ts +33 -1
- package/src/figma/figmaTokens.spec.ts +26 -34
- package/src/figma/figmaTokens.ts +26 -50
- package/src/fonts/createFontLoader.ts +4 -1
- package/src/menuRow.ts +4 -1
- package/src/theme/FontKnobStyles.tsx +2 -1
- package/src/theme/Preset.stories.tsx +0 -1
- package/src/theme/Preset.tsx +6 -1
- package/src/theme/PresetContext.ts +4 -0
- package/src/theme/Surface.spec.tsx +114 -67
- package/src/theme/Surface.stories.tsx +8 -25
- package/src/theme/Surface.tsx +87 -43
- package/src/theme/accentFloor.spec.ts +37 -11
- package/src/theme/activateThemeConfig.ts +22 -6
- package/src/theme/animations/animations.spec.ts +62 -0
- package/src/theme/animations/css.ts +9 -35
- package/src/theme/animations/reactNative.ts +98 -25
- package/src/theme/boundaryFloor.spec.ts +57 -0
- package/src/theme/chartPalette.spec.ts +56 -27
- package/src/theme/chartPalette.ts +33 -28
- package/src/theme/colorRules.spec.ts +32 -72
- package/src/theme/cookies.spec.ts +49 -18
- package/src/theme/cookies.ts +36 -7
- package/src/theme/cookiesPersistence.spec.ts +5 -5
- package/src/theme/createDefaultThemeConfig.spec.ts +182 -20
- package/src/theme/createDefaultThemeConfig.ts +34 -28
- package/src/theme/createThemes.ts +169 -218
- package/src/theme/defaults/accent.ts +3 -35
- package/src/theme/defaults/base.ts +14 -53
- package/src/theme/defaults/builderOptions.ts +68 -85
- package/src/theme/defaults/categoryFonts.ts +10 -0
- package/src/theme/defaults/fonts.spec.ts +84 -4
- package/src/theme/defaults/fonts.ts +166 -124
- package/src/theme/defaults/house.ts +48 -0
- package/src/theme/defaults/index.ts +1 -0
- package/src/theme/defaults/neutralRamp.spec.ts +52 -47
- package/src/theme/devtools/ColorLineVisualizer.tsx +6 -6
- package/src/theme/devtools/ThemeDevtoolsPanel.setMarkers.spec.tsx +13 -6
- package/src/theme/devtools/ThemeDevtoolsPanel.tsx +14 -77
- package/src/theme/devtools/animationOptions.spec.ts +23 -37
- package/src/theme/devtools/animationOptions.ts +4 -6
- package/src/theme/devtools/buildSnapshot.ts +0 -3
- package/src/theme/devtools/knobIcons.tsx +4 -24
- package/src/theme/focusState.spec.ts +9 -30
- package/src/theme/index.ts +17 -0
- package/src/theme/intentFill.spec.ts +42 -0
- package/src/theme/knobs.ts +14 -42
- package/src/theme/layoutTokens.ts +15 -1
- package/src/theme/layoutTokensHooks.spec.tsx +8 -4
- package/src/theme/mergedTokens.ts +20 -0
- package/src/theme/motion.spec.ts +84 -0
- package/src/theme/motion.ts +53 -0
- package/src/theme/motionStops.ts +17 -0
- package/src/theme/motionTiming.ts +59 -0
- package/src/theme/mpo13Proof.spec.ts +43 -46
- package/src/theme/mpo19Proof.spec.ts +13 -14
- package/src/theme/namedInkFloor.spec.ts +60 -0
- package/src/theme/overlaySurfaces.tsx +330 -0
- package/src/theme/preset.types.ts +16 -0
- package/src/theme/presetPreview.ts +32 -0
- package/src/theme/presetRoot.spec.tsx +89 -0
- package/src/theme/presetStore.persistence.spec.ts +141 -0
- package/src/theme/presetStore.spec.ts +205 -0
- package/src/theme/presetStore.ts +286 -0
- package/src/theme/presetUserSync.spec.tsx +168 -0
- package/src/theme/presetUserSync.ts +47 -0
- package/src/theme/presets.spec.ts +22 -15
- package/src/theme/presets.ts +22 -10
- package/src/theme/radiusClass.spec.ts +60 -41
- package/src/theme/radiusClass.ts +17 -4
- package/src/theme/radiusClassTable.generated.ts +3 -3
- package/src/theme/readableColor.spec.ts +59 -152
- package/src/theme/readableColor.ts +34 -174
- package/src/theme/recipeInputs.ts +153 -295
- package/src/theme/recipes.ts +58 -18
- package/src/theme/resolveKnobs.spec.ts +528 -588
- package/src/theme/resolveKnobs.ts +250 -325
- package/src/theme/scale/ScaleStyles.native.tsx +19 -0
- package/src/theme/scale/ScaleStyles.tsx +48 -0
- package/src/theme/scale/activeScale.ts +30 -0
- package/src/theme/scale/deriveRecipeInputs.ts +110 -0
- package/src/theme/scale/generateScale.spec.ts +260 -0
- package/src/theme/scale/generateScale.ts +147 -0
- package/src/theme/scale/index.ts +54 -0
- package/src/theme/scale/installScaleConfig.native.spec.ts +77 -0
- package/src/theme/scale/installScaleConfig.native.ts +57 -0
- package/src/theme/scale/installScaleConfig.ts +7 -0
- package/src/theme/scale/scaleAttribute.ts +21 -0
- package/src/theme/scale/scaleCss.probe.spec.tsx +64 -0
- package/src/theme/scale/scaleCss.spec.ts +132 -0
- package/src/theme/scale/scaleCss.ts +95 -0
- package/src/theme/scale/scaleFonts.ts +106 -0
- package/src/theme/scale/scaleInputs.ts +322 -0
- package/src/theme/scale/themeScales.ts +181 -0
- package/src/theme/scale/useActiveScale.spec.tsx +129 -0
- package/src/theme/scale/useActiveScale.ts +95 -0
- package/src/theme/schemeStore.spec.ts +81 -0
- package/src/theme/schemeStore.ts +67 -0
- package/src/theme/shared.spec.ts +7 -6
- package/src/theme/shared.tsx +37 -3
- package/src/theme/sizeLadder.spec.ts +37 -36
- package/src/theme/sizeRecipes.spec.ts +179 -85
- package/src/theme/sizeRecipes.ts +48 -25
- package/src/theme/subsetThemes.spec.ts +9 -3
- package/src/theme/switchThumb.spec.ts +69 -0
- package/src/theme/syntaxFloor.spec.ts +11 -8
- package/src/theme/theme.hydration.native.spec.tsx +51 -0
- package/src/theme/theme.native.tsx +59 -21
- package/src/theme/theme.palette.spec.tsx +76 -0
- package/src/theme/theme.preset.native.spec.tsx +73 -0
- package/src/theme/theme.provider.spec.ts +143 -1
- package/src/theme/theme.tsx +61 -25
- package/src/theme/tileSizes.ts +6 -7
- package/src/theme/transitionProps.native.ts +25 -2
- package/src/theme/transitionProps.spec.ts +34 -0
- package/src/theme/transitionProps.ts +26 -2
- package/src/theme/usePresetSwitch.native.spec.tsx +68 -0
- package/src/theme/usePresetSwitch.native.ts +32 -0
- package/src/theme/usePresetSwitch.spec.tsx +103 -0
- package/src/theme/usePresetSwitch.ts +54 -0
- package/src/theme/useResolvedKnobs.hydration.spec.tsx +2 -2
- package/src/theme/useResolvedKnobs.ts +23 -90
- package/src/theme/useResolvedKnobsBehavior.spec.tsx +25 -30
- package/src/theme/useSchemePreference.native.ts +33 -0
- package/src/theme/useSchemePreference.spec.tsx +51 -0
- package/src/theme/useSchemePreference.ts +32 -0
- package/src/theme/useSchemePreference.web.spec.tsx +32 -0
- package/src/theme/useTheme.native.spec.tsx +68 -0
- package/src/theme/useTheme.native.ts +49 -24
- package/src/theme/useTheme.ts +7 -4
- package/types/audit/constraintAudit.d.ts +6 -5
- package/types/audit/constraintAudit.d.ts.map +1 -1
- package/types/audit/designTokens.d.ts +13 -0
- package/types/audit/designTokens.d.ts.map +1 -0
- package/types/audit/themeMatrix.d.ts +10 -0
- package/types/audit/themeMatrix.d.ts.map +1 -1
- package/types/figma/figmaTokens.d.ts +11 -28
- package/types/figma/figmaTokens.d.ts.map +1 -1
- package/types/fonts/createFontLoader.d.ts.map +1 -1
- package/types/menuRow.d.ts +4 -1
- package/types/menuRow.d.ts.map +1 -1
- package/types/theme/FontKnobStyles.d.ts.map +1 -1
- package/types/theme/Preset.d.ts.map +1 -1
- package/types/theme/PresetContext.d.ts +4 -0
- package/types/theme/PresetContext.d.ts.map +1 -1
- package/types/theme/Surface.d.ts +57 -26
- package/types/theme/Surface.d.ts.map +1 -1
- package/types/theme/activateThemeConfig.d.ts +5 -3
- package/types/theme/activateThemeConfig.d.ts.map +1 -1
- package/types/theme/animations/css.d.ts +27 -34
- package/types/theme/animations/css.d.ts.map +1 -1
- package/types/theme/animations/reactNative.d.ts +196 -45
- package/types/theme/animations/reactNative.d.ts.map +1 -1
- package/types/theme/chartPalette.d.ts +11 -3
- package/types/theme/chartPalette.d.ts.map +1 -1
- package/types/theme/colorRules.d.ts +1 -1
- package/types/theme/cookies.d.ts +12 -1
- package/types/theme/cookies.d.ts.map +1 -1
- package/types/theme/createDefaultThemeConfig.d.ts +13 -13
- package/types/theme/createDefaultThemeConfig.d.ts.map +1 -1
- package/types/theme/createThemes.d.ts +58 -2
- package/types/theme/createThemes.d.ts.map +1 -1
- package/types/theme/defaults/accent.d.ts.map +1 -1
- package/types/theme/defaults/base.d.ts.map +1 -1
- package/types/theme/defaults/builderOptions.d.ts.map +1 -1
- package/types/theme/defaults/categoryFonts.d.ts +10 -0
- package/types/theme/defaults/categoryFonts.d.ts.map +1 -1
- package/types/theme/defaults/fonts.d.ts +330 -30
- package/types/theme/defaults/fonts.d.ts.map +1 -1
- package/types/theme/defaults/house.d.ts +8 -0
- package/types/theme/defaults/house.d.ts.map +1 -0
- package/types/theme/defaults/index.d.ts +1 -0
- package/types/theme/defaults/index.d.ts.map +1 -1
- package/types/theme/devtools/ThemeDevtoolsPanel.d.ts +3 -3
- package/types/theme/devtools/ThemeDevtoolsPanel.d.ts.map +1 -1
- package/types/theme/devtools/animationOptions.d.ts.map +1 -1
- package/types/theme/devtools/buildSnapshot.d.ts.map +1 -1
- package/types/theme/devtools/knobIcons.d.ts +0 -3
- package/types/theme/devtools/knobIcons.d.ts.map +1 -1
- package/types/theme/index.d.ts +11 -0
- package/types/theme/index.d.ts.map +1 -1
- package/types/theme/knobs.d.ts +8 -36
- package/types/theme/knobs.d.ts.map +1 -1
- package/types/theme/layoutTokens.d.ts +13 -1
- package/types/theme/layoutTokens.d.ts.map +1 -1
- package/types/theme/mergedTokens.d.ts +11 -0
- package/types/theme/mergedTokens.d.ts.map +1 -0
- package/types/theme/motion.d.ts +17 -0
- package/types/theme/motion.d.ts.map +1 -0
- package/types/theme/motionStops.d.ts +3 -0
- package/types/theme/motionStops.d.ts.map +1 -0
- package/types/theme/motionTiming.d.ts +36 -0
- package/types/theme/motionTiming.d.ts.map +1 -0
- package/types/theme/overlaySurfaces.d.ts +70 -0
- package/types/theme/overlaySurfaces.d.ts.map +1 -0
- package/types/theme/preset.types.d.ts +16 -0
- package/types/theme/preset.types.d.ts.map +1 -1
- package/types/theme/presetPreview.d.ts +14 -0
- package/types/theme/presetPreview.d.ts.map +1 -0
- package/types/theme/presetStore.d.ts +40 -0
- package/types/theme/presetStore.d.ts.map +1 -0
- package/types/theme/presetUserSync.d.ts +7 -0
- package/types/theme/presetUserSync.d.ts.map +1 -0
- package/types/theme/presets.d.ts +12 -4
- package/types/theme/presets.d.ts.map +1 -1
- package/types/theme/radiusClass.d.ts +5 -2
- package/types/theme/radiusClass.d.ts.map +1 -1
- package/types/theme/radiusClassTable.generated.d.ts +3 -3
- package/types/theme/readableColor.d.ts +11 -49
- package/types/theme/readableColor.d.ts.map +1 -1
- package/types/theme/recipeInputs.d.ts +39 -70
- package/types/theme/recipeInputs.d.ts.map +1 -1
- package/types/theme/recipes.d.ts +79 -18
- package/types/theme/recipes.d.ts.map +1 -1
- package/types/theme/resolveKnobs.d.ts +64 -32
- package/types/theme/resolveKnobs.d.ts.map +1 -1
- package/types/theme/scale/ScaleStyles.d.ts +18 -0
- package/types/theme/scale/ScaleStyles.d.ts.map +1 -0
- package/types/theme/scale/ScaleStyles.native.d.ts +10 -0
- package/types/theme/scale/ScaleStyles.native.d.ts.map +1 -0
- package/types/theme/scale/activeScale.d.ts +13 -0
- package/types/theme/scale/activeScale.d.ts.map +1 -0
- package/types/theme/scale/deriveRecipeInputs.d.ts +10 -0
- package/types/theme/scale/deriveRecipeInputs.d.ts.map +1 -0
- package/types/theme/scale/generateScale.d.ts +38 -0
- package/types/theme/scale/generateScale.d.ts.map +1 -0
- package/types/theme/scale/index.d.ts +17 -0
- package/types/theme/scale/index.d.ts.map +1 -0
- package/types/theme/scale/installScaleConfig.d.ts +4 -0
- package/types/theme/scale/installScaleConfig.d.ts.map +1 -0
- package/types/theme/scale/installScaleConfig.native.d.ts +13 -0
- package/types/theme/scale/installScaleConfig.native.d.ts.map +1 -0
- package/types/theme/scale/scaleAttribute.d.ts +14 -0
- package/types/theme/scale/scaleAttribute.d.ts.map +1 -0
- package/types/theme/scale/scaleCss.d.ts +25 -0
- package/types/theme/scale/scaleCss.d.ts.map +1 -0
- package/types/theme/scale/scaleFonts.d.ts +16 -0
- package/types/theme/scale/scaleFonts.d.ts.map +1 -0
- package/types/theme/scale/scaleInputs.d.ts +66 -0
- package/types/theme/scale/scaleInputs.d.ts.map +1 -0
- package/types/theme/scale/themeScales.d.ts +52 -0
- package/types/theme/scale/themeScales.d.ts.map +1 -0
- package/types/theme/scale/useActiveScale.d.ts +31 -0
- package/types/theme/scale/useActiveScale.d.ts.map +1 -0
- package/types/theme/schemeStore.d.ts +6 -0
- package/types/theme/schemeStore.d.ts.map +1 -0
- package/types/theme/shared.d.ts +18 -0
- package/types/theme/shared.d.ts.map +1 -1
- package/types/theme/sizeRecipes.d.ts +20 -15
- package/types/theme/sizeRecipes.d.ts.map +1 -1
- package/types/theme/theme.d.ts +2 -1
- package/types/theme/theme.d.ts.map +1 -1
- package/types/theme/theme.native.d.ts +10 -1
- package/types/theme/theme.native.d.ts.map +1 -1
- package/types/theme/tileSizes.d.ts +6 -7
- package/types/theme/tileSizes.d.ts.map +1 -1
- package/types/theme/transitionProps.d.ts +3 -1
- package/types/theme/transitionProps.d.ts.map +1 -1
- package/types/theme/transitionProps.native.d.ts +3 -1
- package/types/theme/transitionProps.native.d.ts.map +1 -1
- package/types/theme/usePresetSwitch.d.ts +10 -0
- package/types/theme/usePresetSwitch.d.ts.map +1 -0
- package/types/theme/usePresetSwitch.native.d.ts +10 -0
- package/types/theme/usePresetSwitch.native.d.ts.map +1 -0
- package/types/theme/useResolvedKnobs.d.ts +13 -13
- package/types/theme/useResolvedKnobs.d.ts.map +1 -1
- package/types/theme/useSchemePreference.d.ts +8 -0
- package/types/theme/useSchemePreference.d.ts.map +1 -0
- package/types/theme/useSchemePreference.native.d.ts +8 -0
- package/types/theme/useSchemePreference.native.d.ts.map +1 -0
- package/types/theme/useTheme.d.ts +4 -2
- package/types/theme/useTheme.d.ts.map +1 -1
- package/types/theme/useTheme.native.d.ts +10 -1
- package/types/theme/useTheme.native.d.ts.map +1 -1
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import * as Colors from "@tamagui/colors";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
type CreateThemesProps,
|
|
5
|
-
} from "@tamagui/theme-builder";
|
|
6
|
-
import { themes as tamaguiThemes } from "@tamagui/themes";
|
|
2
|
+
import { createThemes as tamaguiCreateThemes } from "@tamagui/theme-builder";
|
|
3
|
+
import { defaultChildrenThemes, v5Templates } from "@tamagui/themes/v5";
|
|
7
4
|
import {
|
|
8
5
|
aaTextContrastRatio,
|
|
9
6
|
contrastRatio,
|
|
@@ -13,45 +10,18 @@ import {
|
|
|
13
10
|
} from "./colorRules";
|
|
14
11
|
|
|
15
12
|
/**
|
|
16
|
-
* MPO-40. Radix
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
* upstream and wrong here.
|
|
23
|
-
*
|
|
24
|
-
* Only these two stops move. Light `red11` clears at 4.95:1 and every dark
|
|
25
|
-
* intent stop clears by 8.49:1 or more, measured, so red and both dark ramps
|
|
26
|
-
* stay untouched stock Radix — as does every other step of yellow and green.
|
|
27
|
-
*
|
|
28
|
-
* The replacements are the smallest darkening that clears the floor on the
|
|
29
|
-
* strictest base surface while holding the hue — dE76 1.94 for warning and
|
|
30
|
-
* 0.70 for success, both far under the ~2.3 just-noticeable difference, so
|
|
31
|
-
* neither intent hue visibly shifts.
|
|
32
|
-
*
|
|
33
|
-
* THESE ARE QUANTIZED VALUES, and that is not a detail. `createThemes` stores
|
|
34
|
-
* every palette entry through color2k as `hsla()` with INTEGER degrees and
|
|
35
|
-
* percentages, so the reachable palette is coarser than hex and a hex chosen
|
|
36
|
-
* on paper is not what renders. The first pass here picked `#996800` /
|
|
37
|
-
* `#208156` by minimising CIEDE2000 in hex space; `#208156` quantized to the
|
|
38
|
-
* SAME `hsla(154, 60%, 32%)` as the stock stop and changed nothing at all,
|
|
39
|
-
* while `#996800` landed two hundredths off its predicted ratio. Both values
|
|
40
|
-
* below were searched in the quantized space and confirmed against the built
|
|
41
|
-
* theme, not against the arithmetic.
|
|
42
|
-
*
|
|
43
|
-
* `$color11` is ALSO the solid intent Button's resting fill (`step(10)` in
|
|
44
|
-
* `defaults/builderOptions.ts`), so this shifts that fill by the same
|
|
45
|
-
* imperceptible amount. It improves it: the solid warning Button's
|
|
46
|
-
* luminance-picked on-fill label was itself at 4.48:1 — a second, unpinned AA
|
|
47
|
-
* miss. The `pickReadableForeground` anchor does not flip for either intent,
|
|
48
|
-
* so no label changes colour.
|
|
13
|
+
* MPO-40. Radix step 11 targets its own surface, but intent ink also paints on
|
|
14
|
+
* the base page. The v5 $background/$color2 is hsla(0, 0%, 97%, 1): the
|
|
15
|
+
* previous warning/success floors fall to 4.48/4.47:1 there. These replacements
|
|
16
|
+
* were searched in integer HSL (color2k's stored space), minimizing dE76 from
|
|
17
|
+
* stock within one degree of its hue, then checked against the built theme.
|
|
18
|
+
* Only light step 11 changes; the base ramp stays stock v5.
|
|
49
19
|
*/
|
|
50
20
|
const intentInkFloor = {
|
|
51
|
-
/**
|
|
52
|
-
warning: "#
|
|
53
|
-
/**
|
|
54
|
-
success: "#
|
|
21
|
+
/** Stored hsla(41, 99%, 30%, 1); 4.54:1 on $color2, dE76 2.54. */
|
|
22
|
+
warning: "#986801",
|
|
23
|
+
/** Stored hsla(154, 63%, 31%, 1); 4.53:1 on $color2, dE76 0.82. */
|
|
24
|
+
success: "#1d8156",
|
|
55
25
|
} as const;
|
|
56
26
|
|
|
57
27
|
/**
|
|
@@ -67,16 +37,28 @@ function withIntentInkFloor(palette: string[], ink: string): string[] {
|
|
|
67
37
|
return stepped;
|
|
68
38
|
}
|
|
69
39
|
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
}
|
|
40
|
+
export const houseComponentThemes = {
|
|
41
|
+
Button: { template: "surface2" },
|
|
42
|
+
Input: { template: "surface1" },
|
|
43
|
+
TextArea: { template: "surface1" },
|
|
44
|
+
Progress: { template: "surface1" },
|
|
45
|
+
ProgressIndicator: { template: "surface3" },
|
|
46
|
+
Slider: { template: "surface1" },
|
|
47
|
+
SliderActive: { template: "surface3" },
|
|
48
|
+
SliderThumb: { template: "surface2" },
|
|
49
|
+
Switch: { template: "surface2" },
|
|
50
|
+
Card: { template: "surface1" },
|
|
51
|
+
ListItem: { template: "surface1" },
|
|
52
|
+
SelectTrigger: { template: "surface1" },
|
|
53
|
+
SelectItem: { template: "surface1" },
|
|
54
|
+
InputContainerFrame: { template: "surface1" },
|
|
55
|
+
} as const;
|
|
56
|
+
|
|
57
|
+
export const houseGrandChildrenThemes = {
|
|
58
|
+
active: { template: "surface3" },
|
|
59
|
+
alt1: { template: "surface1" },
|
|
60
|
+
alt2: { template: "surface2" },
|
|
61
|
+
} as const;
|
|
80
62
|
|
|
81
63
|
export interface Shadows {
|
|
82
64
|
shadow1: string;
|
|
@@ -116,7 +98,8 @@ export interface GetThemeProps {
|
|
|
116
98
|
}
|
|
117
99
|
|
|
118
100
|
export interface CreateThemesBuilderOptions {
|
|
119
|
-
|
|
101
|
+
componentThemes?: Parameters<typeof tamaguiCreateThemes>[0]["componentThemes"];
|
|
102
|
+
grandChildrenThemes?: Parameters<typeof tamaguiCreateThemes>[0]["grandChildrenThemes"];
|
|
120
103
|
getTheme?: (props: GetThemeProps) => Record<string, string | number | null | undefined>;
|
|
121
104
|
}
|
|
122
105
|
|
|
@@ -283,23 +266,10 @@ function nearestHoldingStep(
|
|
|
283
266
|
}
|
|
284
267
|
|
|
285
268
|
/**
|
|
286
|
-
*
|
|
287
|
-
*
|
|
288
|
-
*
|
|
289
|
-
*
|
|
290
|
-
* anchor, and the ink (`#46349d`) reads 1.74:1 on the dark page. LC-05 keeps
|
|
291
|
-
* the channel and frees the step, so each token walks to the nearest accent
|
|
292
|
-
* step that holds its floor and stays put where it already does (light).
|
|
293
|
-
*
|
|
294
|
-
* - `accentBackground` is a text-bearing solid: its better anchor (`$color1`
|
|
295
|
-
* or `$color12`) clears 4.5:1 on it, and it keeps the 3:1 graphic tier
|
|
296
|
-
* against the page, because dots, edges and bars paint it bare.
|
|
297
|
-
* - `accentColor` is accent ink: 4.5:1 on the page and the first raised
|
|
298
|
-
* surface (`$color1`-`$color3`).
|
|
299
|
-
*
|
|
300
|
-
* Every theme of the scheme that inherited the base pair (the intent
|
|
301
|
-
* children) takes the corrected pair; one that set its own (the inverse
|
|
302
|
-
* component themes) keeps it.
|
|
269
|
+
* MPO-448 / MPO-449. Keep the accent fill readable with its better base anchor
|
|
270
|
+
* (4.5:1), and visible against the page (3:1). Accent ink needs 4.5:1 on
|
|
271
|
+
* color1..color3. Walk to the nearest holding accent step; themes with their
|
|
272
|
+
* own pair keep it.
|
|
303
273
|
*/
|
|
304
274
|
function holdAccentFloor(
|
|
305
275
|
themes: Record<string, Record<string, string>>,
|
|
@@ -339,6 +309,53 @@ function holdAccentFloor(
|
|
|
339
309
|
return out;
|
|
340
310
|
}
|
|
341
311
|
|
|
312
|
+
/**
|
|
313
|
+
* FZ-7158 WP-b2 / DF-06. The off Switch track is the first grey step that
|
|
314
|
+
* holds 3:1 under the white thumb and 1.5:1 from the accent on track, and
|
|
315
|
+
* 3:1 on the page and surface1 when a step can hold all four. Dark's accent
|
|
316
|
+
* fill sits between gray9 and gray10, so dark falls back to gray7 and the
|
|
317
|
+
* thumb carries the page contrast. Hover is one step toward the page, press
|
|
318
|
+
* one step away. Runs after holdAccentFloor, which settles the on track.
|
|
319
|
+
* Only the scheme roots carry the keys and every child inherits them: one
|
|
320
|
+
* copy per theme overruns the CSS budget in createDefaultThemeConfig.spec.ts.
|
|
321
|
+
*/
|
|
322
|
+
const switchOffSteps = [10, 9, 8, 7, 6, 5] as const;
|
|
323
|
+
const switchStateContrastRatio = 1.5;
|
|
324
|
+
|
|
325
|
+
function holdSwitchTrack(
|
|
326
|
+
themes: Record<string, Record<string, string>>,
|
|
327
|
+
): Record<string, Record<string, string>> {
|
|
328
|
+
const out: Record<string, Record<string, string>> = { ...themes };
|
|
329
|
+
for (const scheme of ["light", "dark"] as const) {
|
|
330
|
+
const base = themes[scheme];
|
|
331
|
+
if (!base) continue;
|
|
332
|
+
const thumb = luminanceOf(base.switchThumb ?? "#ffffff");
|
|
333
|
+
const on = luminanceOf(base.accentBackground);
|
|
334
|
+
const surfaces = [base.background, base.color3].map(luminanceOf);
|
|
335
|
+
if (thumb === null || on === null || surfaces.some((lum) => lum === null)) continue;
|
|
336
|
+
const holds = (step: number, onPage: boolean) => {
|
|
337
|
+
const lum = luminanceOf(base[`gray${step}`]);
|
|
338
|
+
return (
|
|
339
|
+
lum !== null &&
|
|
340
|
+
contrastRatio(lum, thumb) >= minContrastRatio &&
|
|
341
|
+
contrastRatio(lum, on) >= switchStateContrastRatio &&
|
|
342
|
+
(!onPage || surfaces.every((surface) => contrastRatio(lum, surface!) >= minContrastRatio))
|
|
343
|
+
);
|
|
344
|
+
};
|
|
345
|
+
const off =
|
|
346
|
+
switchOffSteps.find((step) => holds(step, true)) ??
|
|
347
|
+
switchOffSteps.find((step) => holds(step, false));
|
|
348
|
+
if (off === undefined) continue;
|
|
349
|
+
const paint = {
|
|
350
|
+
switchTrackOff: base[`gray${off}`],
|
|
351
|
+
switchTrackOffHover: base[`gray${off - 1}`],
|
|
352
|
+
switchTrackOffPress: base[`gray${off + 1}`],
|
|
353
|
+
};
|
|
354
|
+
out[scheme] = { ...base, ...paint };
|
|
355
|
+
}
|
|
356
|
+
return out;
|
|
357
|
+
}
|
|
358
|
+
|
|
342
359
|
/** The hues the code syntax palette paints (MPO-468). */
|
|
343
360
|
const syntaxInkHues = ["purple", "green", "blue", "orange", "red"] as const;
|
|
344
361
|
|
|
@@ -354,14 +371,9 @@ function mixHex(from: string, to: string, share: number): string {
|
|
|
354
371
|
}
|
|
355
372
|
|
|
356
373
|
/**
|
|
357
|
-
*
|
|
358
|
-
*
|
|
359
|
-
*
|
|
360
|
-
* 4.27 and 4.04:1. Every theme that carries the hue ramps gets a
|
|
361
|
-
* `syntax<Hue>` ink: step 11, walked toward step 12 in twentieths until it
|
|
362
|
-
* clears 4.5:1 on that theme's `$color3` and on the hue's step-3 wash, which
|
|
363
|
-
* diff lines paint. Dark keeps step 11; a theme where no step holds gets no
|
|
364
|
-
* token and inherits its parent's.
|
|
374
|
+
* MPO-468. Syntax ink paints on both color3 and the hue's step-3 diff wash.
|
|
375
|
+
* Radix only targets its own page, so walk step 11 toward step 12 in twentieths
|
|
376
|
+
* until both surfaces clear 4.5:1. A theme with no holding step inherits.
|
|
365
377
|
*/
|
|
366
378
|
function holdSyntaxFloor(
|
|
367
379
|
themes: Record<string, Record<string, string>>,
|
|
@@ -393,24 +405,71 @@ function holdSyntaxFloor(
|
|
|
393
405
|
return out;
|
|
394
406
|
}
|
|
395
407
|
|
|
408
|
+
const namedInkHues = Object.keys(defaultChildrenThemes).filter((hue) => hue !== "neutral");
|
|
409
|
+
|
|
410
|
+
/**
|
|
411
|
+
* Radix aims a hue's step 11 at 4.5:1 on its own steps 1-2, but status text,
|
|
412
|
+
* diffs and links paint the named step 11 on v5's grey page and surface1 card
|
|
413
|
+
* (`$background` and `$color3`), where light green, blue, orange, yellow, teal
|
|
414
|
+
* and red measured 3.85 to 4.45:1. Walk each named step 11 toward step 12 in
|
|
415
|
+
* twentieths until both surfaces clear 4.5:1. A step that already holds stays.
|
|
416
|
+
* v5's `neutral` is a mid-grey control palette, never page ink, so it is left out.
|
|
417
|
+
*/
|
|
418
|
+
function holdNamedInkFloor(
|
|
419
|
+
themes: Record<string, Record<string, string>>,
|
|
420
|
+
): Record<string, Record<string, string>> {
|
|
421
|
+
const out: Record<string, Record<string, string>> = { ...themes };
|
|
422
|
+
for (const [name, theme] of Object.entries(themes)) {
|
|
423
|
+
const surfaces = [luminanceOf(theme.background), luminanceOf(theme.color3)];
|
|
424
|
+
if (surfaces.some((surface) => surface === null)) continue;
|
|
425
|
+
const ink: Record<string, string> = {};
|
|
426
|
+
for (const hue of namedInkHues) {
|
|
427
|
+
const from = theme[`${hue}11`] ? normalizeToHex(theme[`${hue}11`]) : null;
|
|
428
|
+
const to = theme[`${hue}12`] ? normalizeToHex(theme[`${hue}12`]) : null;
|
|
429
|
+
if (!from || !to) continue;
|
|
430
|
+
for (let step = 0; step <= 20; step++) {
|
|
431
|
+
const candidate = mixHex(from, to, step / 20);
|
|
432
|
+
const lum = relativeLuminance(candidate);
|
|
433
|
+
if (surfaces.every((surface) => contrastRatio(lum, surface!) >= aaTextContrastRatio)) {
|
|
434
|
+
if (step > 0) ink[`${hue}11`] = candidate;
|
|
435
|
+
break;
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
if (Object.keys(ink).length > 0) out[name] = { ...theme, ...ink };
|
|
440
|
+
}
|
|
441
|
+
return out;
|
|
442
|
+
}
|
|
443
|
+
|
|
396
444
|
const defaultLightShadows: Shadows = {
|
|
397
|
-
shadow1: "rgba(0,0,0,0.
|
|
398
|
-
shadow2: "rgba(0,0,0,0.
|
|
399
|
-
shadow3: "rgba(0,0,0,0.
|
|
400
|
-
shadow4: "rgba(0,0,0,0.
|
|
401
|
-
shadow5: "rgba(0,0,0,0.
|
|
402
|
-
shadow6: "rgba(0,0,0,0.
|
|
445
|
+
shadow1: "rgba(0,0,0,0.04)",
|
|
446
|
+
shadow2: "rgba(0,0,0,0.08)",
|
|
447
|
+
shadow3: "rgba(0,0,0,0.12)",
|
|
448
|
+
shadow4: "rgba(0,0,0,0.22)",
|
|
449
|
+
shadow5: "rgba(0,0,0,0.33)",
|
|
450
|
+
shadow6: "rgba(0,0,0,0.44)",
|
|
403
451
|
};
|
|
404
452
|
|
|
405
453
|
const defaultDarkShadows: Shadows = {
|
|
406
|
-
shadow1: "rgba(0,0,0,0.
|
|
407
|
-
shadow2: "rgba(0,0,0,0.
|
|
408
|
-
shadow3: "rgba(0,0,0,0.
|
|
409
|
-
shadow4: "rgba(0,0,0,0.
|
|
410
|
-
shadow5: "rgba(0,0,0,0.
|
|
411
|
-
shadow6: "rgba(0,0,0,0.
|
|
454
|
+
shadow1: "rgba(0,0,0,0.15)",
|
|
455
|
+
shadow2: "rgba(0,0,0,0.23)",
|
|
456
|
+
shadow3: "rgba(0,0,0,0.33)",
|
|
457
|
+
shadow4: "rgba(0,0,0,0.45)",
|
|
458
|
+
shadow5: "rgba(0,0,0,0.65)",
|
|
459
|
+
shadow6: "rgba(0,0,0,0.8)",
|
|
412
460
|
};
|
|
413
461
|
|
|
462
|
+
const childrenHues = [
|
|
463
|
+
"blue",
|
|
464
|
+
"red",
|
|
465
|
+
"green",
|
|
466
|
+
"yellow",
|
|
467
|
+
"orange",
|
|
468
|
+
"pink",
|
|
469
|
+
"purple",
|
|
470
|
+
"gray",
|
|
471
|
+
] as const;
|
|
472
|
+
|
|
414
473
|
export function createThemesBuilder(
|
|
415
474
|
baseTheme: BaseThemeBuilderDefinition,
|
|
416
475
|
accentTheme: ThemeBuilderDefinition,
|
|
@@ -424,128 +483,24 @@ export function createThemesBuilder(
|
|
|
424
483
|
},
|
|
425
484
|
extra: {
|
|
426
485
|
light: {
|
|
427
|
-
...
|
|
428
|
-
...Colors.amberA,
|
|
429
|
-
...Colors.blue,
|
|
430
|
-
...Colors.blueA,
|
|
431
|
-
...Colors.bronze,
|
|
432
|
-
...Colors.bronzeA,
|
|
433
|
-
...Colors.brown,
|
|
434
|
-
...Colors.brownA,
|
|
435
|
-
...Colors.crimson,
|
|
436
|
-
...Colors.crimsonA,
|
|
437
|
-
...Colors.cyan,
|
|
438
|
-
...Colors.cyanA,
|
|
439
|
-
...Colors.gold,
|
|
440
|
-
...Colors.goldA,
|
|
441
|
-
...Colors.grass,
|
|
442
|
-
...Colors.grassA,
|
|
443
|
-
...Colors.gray,
|
|
444
|
-
...Colors.grayA,
|
|
445
|
-
...Colors.green,
|
|
446
|
-
...Colors.greenA,
|
|
447
|
-
...Colors.indigo,
|
|
448
|
-
...Colors.indigoA,
|
|
449
|
-
...Colors.lime,
|
|
450
|
-
...Colors.limeA,
|
|
451
|
-
...Colors.mauve,
|
|
452
|
-
...Colors.mauveA,
|
|
453
|
-
...Colors.mint,
|
|
454
|
-
...Colors.mintA,
|
|
455
|
-
...Colors.olive,
|
|
456
|
-
...Colors.oliveA,
|
|
457
|
-
...Colors.orange,
|
|
458
|
-
...Colors.orangeA,
|
|
459
|
-
...Colors.pink,
|
|
460
|
-
...Colors.pinkA,
|
|
461
|
-
...Colors.plum,
|
|
462
|
-
...Colors.plumA,
|
|
463
|
-
...Colors.purple,
|
|
464
|
-
...Colors.purpleA,
|
|
465
|
-
...Colors.red,
|
|
466
|
-
...Colors.redA,
|
|
467
|
-
...Colors.sage,
|
|
468
|
-
...Colors.sageA,
|
|
469
|
-
...Colors.sand,
|
|
470
|
-
...Colors.sandA,
|
|
471
|
-
...Colors.sky,
|
|
472
|
-
...Colors.skyA,
|
|
473
|
-
...Colors.slate,
|
|
474
|
-
...Colors.slateA,
|
|
475
|
-
...Colors.teal,
|
|
476
|
-
...Colors.tealA,
|
|
477
|
-
...Colors.tomato,
|
|
478
|
-
...Colors.tomatoA,
|
|
479
|
-
...Colors.violet,
|
|
480
|
-
...Colors.violetA,
|
|
481
|
-
...Colors.yellow,
|
|
482
|
-
...Colors.yellowA,
|
|
486
|
+
...Object.assign({}, ...Object.values(defaultChildrenThemes).map((theme) => theme.light)),
|
|
483
487
|
...baseTheme.lightShadows,
|
|
484
|
-
shadowColor: baseTheme.lightShadows?.
|
|
488
|
+
shadowColor: baseTheme.lightShadows?.shadow3 || defaultLightShadows.shadow3,
|
|
485
489
|
},
|
|
486
490
|
dark: {
|
|
487
|
-
...
|
|
488
|
-
...Colors.amberDarkA,
|
|
489
|
-
...Colors.blueDark,
|
|
490
|
-
...Colors.blueDarkA,
|
|
491
|
-
...Colors.bronzeDark,
|
|
492
|
-
...Colors.bronzeDarkA,
|
|
493
|
-
...Colors.brownDark,
|
|
494
|
-
...Colors.brownDarkA,
|
|
495
|
-
...Colors.crimsonDark,
|
|
496
|
-
...Colors.crimsonDarkA,
|
|
497
|
-
...Colors.cyanDark,
|
|
498
|
-
...Colors.cyanDarkA,
|
|
499
|
-
...Colors.goldDark,
|
|
500
|
-
...Colors.goldDarkA,
|
|
501
|
-
...Colors.grassDark,
|
|
502
|
-
...Colors.grassDarkA,
|
|
503
|
-
...Colors.grayDark,
|
|
504
|
-
...Colors.grayDarkA,
|
|
505
|
-
...Colors.greenDark,
|
|
506
|
-
...Colors.greenDarkA,
|
|
507
|
-
...Colors.indigoDark,
|
|
508
|
-
...Colors.indigoDarkA,
|
|
509
|
-
...Colors.limeDark,
|
|
510
|
-
...Colors.limeDarkA,
|
|
511
|
-
...Colors.mauveDark,
|
|
512
|
-
...Colors.mauveDarkA,
|
|
513
|
-
...Colors.mintDark,
|
|
514
|
-
...Colors.mintDarkA,
|
|
515
|
-
...Colors.oliveDark,
|
|
516
|
-
...Colors.oliveDarkA,
|
|
517
|
-
...Colors.orangeDark,
|
|
518
|
-
...Colors.orangeDarkA,
|
|
519
|
-
...Colors.pinkDark,
|
|
520
|
-
...Colors.pinkDarkA,
|
|
521
|
-
...Colors.plumDark,
|
|
522
|
-
...Colors.plumDarkA,
|
|
523
|
-
...Colors.purpleDark,
|
|
524
|
-
...Colors.purpleDarkA,
|
|
525
|
-
...Colors.redDark,
|
|
526
|
-
...Colors.redDarkA,
|
|
527
|
-
...Colors.sageDark,
|
|
528
|
-
...Colors.sageDarkA,
|
|
529
|
-
...Colors.sandDark,
|
|
530
|
-
...Colors.sandDarkA,
|
|
531
|
-
...Colors.skyDark,
|
|
532
|
-
...Colors.skyDarkA,
|
|
533
|
-
...Colors.slateDark,
|
|
534
|
-
...Colors.slateDarkA,
|
|
535
|
-
...Colors.tealDark,
|
|
536
|
-
...Colors.tealDarkA,
|
|
537
|
-
...Colors.tomatoDark,
|
|
538
|
-
...Colors.tomatoDarkA,
|
|
539
|
-
...Colors.violetDark,
|
|
540
|
-
...Colors.violetDarkA,
|
|
541
|
-
...Colors.yellowDark,
|
|
542
|
-
...Colors.yellowDarkA,
|
|
491
|
+
...Object.assign({}, ...Object.values(defaultChildrenThemes).map((theme) => theme.dark)),
|
|
543
492
|
...baseTheme.darkShadows,
|
|
544
|
-
shadowColor: baseTheme.darkShadows?.
|
|
493
|
+
shadowColor: baseTheme.darkShadows?.shadow3 || defaultDarkShadows.shadow3,
|
|
545
494
|
},
|
|
546
495
|
},
|
|
547
496
|
};
|
|
548
497
|
const childrenThemes = {
|
|
498
|
+
...Object.fromEntries(
|
|
499
|
+
childrenHues.map((name) => {
|
|
500
|
+
const { light, dark } = defaultChildrenThemes[name];
|
|
501
|
+
return [name, { palette: { light: Object.values(light), dark: Object.values(dark) } }];
|
|
502
|
+
}),
|
|
503
|
+
),
|
|
549
504
|
warning: {
|
|
550
505
|
palette: {
|
|
551
506
|
dark: Object.values(Colors.yellowDark),
|
|
@@ -566,6 +521,9 @@ export function createThemesBuilder(
|
|
|
566
521
|
},
|
|
567
522
|
};
|
|
568
523
|
const createThemesProps: Record<string, unknown> = {
|
|
524
|
+
templates: v5Templates,
|
|
525
|
+
componentThemes: options?.componentThemes ?? houseComponentThemes,
|
|
526
|
+
grandChildrenThemes: options?.grandChildrenThemes ?? houseGrandChildrenThemes,
|
|
569
527
|
base,
|
|
570
528
|
childrenThemes,
|
|
571
529
|
accent: {
|
|
@@ -575,23 +533,16 @@ export function createThemesBuilder(
|
|
|
575
533
|
},
|
|
576
534
|
},
|
|
577
535
|
};
|
|
578
|
-
if (options?.grandChildrenThemes) {
|
|
579
|
-
createThemesProps.grandChildrenThemes = options.grandChildrenThemes;
|
|
580
|
-
}
|
|
581
536
|
if (getTheme) {
|
|
582
537
|
createThemesProps.getTheme = getTheme;
|
|
583
538
|
}
|
|
584
539
|
const initialTheme = tamaguiCreateThemes(
|
|
585
540
|
createThemesProps as Parameters<typeof tamaguiCreateThemes>[0],
|
|
586
541
|
);
|
|
587
|
-
const themes =
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
neutralizeTintText(
|
|
591
|
-
...grayTheme,
|
|
592
|
-
...tamaguiThemes,
|
|
593
|
-
...initialTheme,
|
|
594
|
-
}),
|
|
542
|
+
const themes = holdSwitchTrack(
|
|
543
|
+
holdSyntaxFloor(
|
|
544
|
+
holdNamedInkFloor(
|
|
545
|
+
holdAccentFloor(neutralizeSemanticEntryText(neutralizeTintText(initialTheme))),
|
|
595
546
|
),
|
|
596
547
|
),
|
|
597
548
|
);
|
|
@@ -601,6 +552,9 @@ export function createThemesBuilder(
|
|
|
601
552
|
},
|
|
602
553
|
addTheme<K extends string>(name: K, theme: ThemeBuilderDefinition) {
|
|
603
554
|
const addThemeProps: Record<string, unknown> = {
|
|
555
|
+
templates: v5Templates,
|
|
556
|
+
componentThemes: options?.componentThemes ?? houseComponentThemes,
|
|
557
|
+
grandChildrenThemes: options?.grandChildrenThemes ?? houseGrandChildrenThemes,
|
|
604
558
|
base,
|
|
605
559
|
childrenThemes,
|
|
606
560
|
accent: {
|
|
@@ -610,9 +564,6 @@ export function createThemesBuilder(
|
|
|
610
564
|
},
|
|
611
565
|
},
|
|
612
566
|
};
|
|
613
|
-
if (options?.grandChildrenThemes) {
|
|
614
|
-
addThemeProps.grandChildrenThemes = options.grandChildrenThemes;
|
|
615
|
-
}
|
|
616
567
|
if (getTheme) {
|
|
617
568
|
addThemeProps.getTheme = getTheme;
|
|
618
569
|
}
|
|
@@ -1,39 +1,7 @@
|
|
|
1
|
+
import { defaultDarkPalette, defaultLightPalette } from "@tamagui/themes/v5";
|
|
1
2
|
import type { ThemeBuilderDefinition } from "../createThemes";
|
|
2
3
|
|
|
3
4
|
export const defaultAccentTheme: ThemeBuilderDefinition = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
"hsla(250, 50%, 38%, 1)",
|
|
7
|
-
"hsla(250, 50%, 41%, 1)",
|
|
8
|
-
"hsla(250, 50%, 43%, 1)",
|
|
9
|
-
"hsla(250, 50%, 46%, 1)",
|
|
10
|
-
"hsla(250, 50%, 49%, 1)",
|
|
11
|
-
"hsla(250, 50%, 52%, 1)",
|
|
12
|
-
"hsla(250, 50%, 54%, 1)",
|
|
13
|
-
"hsla(250, 50%, 57%, 1)",
|
|
14
|
-
"hsla(250, 50%, 60%, 1)",
|
|
15
|
-
"hsla(250, 50%, 90%, 1)",
|
|
16
|
-
"hsla(250, 50%, 95%, 1)",
|
|
17
|
-
],
|
|
18
|
-
// Mirrors the darkPalette's shape: SOLID brand surfaces across [0..9] with
|
|
19
|
-
// near-white foreground anchors at [10..11]. The theme-builder takes
|
|
20
|
-
// palette[11] as the sub-theme `color` and palette[3] as the Button
|
|
21
|
-
// surface — the old ramp (95%->40%, no light anchor) put 40%-purple text
|
|
22
|
-
// on a 62%-purple button (2.3:1). Solid-with-white matches how tamagui v4
|
|
23
|
-
// ships its accent (bg 9%, color white, 17.9:1); here: button 48%/98%
|
|
24
|
-
// = 7.7:1.
|
|
25
|
-
lightPalette: [
|
|
26
|
-
"hsla(250, 50%, 62%, 1)",
|
|
27
|
-
"hsla(250, 50%, 58%, 1)",
|
|
28
|
-
"hsla(250, 50%, 54%, 1)",
|
|
29
|
-
"hsla(250, 50%, 48%, 1)",
|
|
30
|
-
"hsla(250, 50%, 46%, 1)",
|
|
31
|
-
"hsla(250, 50%, 44%, 1)",
|
|
32
|
-
"hsla(250, 50%, 42%, 1)",
|
|
33
|
-
"hsla(250, 50%, 40%, 1)",
|
|
34
|
-
"hsla(250, 50%, 38%, 1)",
|
|
35
|
-
"hsla(250, 50%, 36%, 1)",
|
|
36
|
-
"hsla(250, 50%, 95%, 1)",
|
|
37
|
-
"hsla(250, 50%, 98%, 1)",
|
|
38
|
-
],
|
|
5
|
+
lightPalette: [...defaultDarkPalette],
|
|
6
|
+
darkPalette: [...defaultLightPalette],
|
|
39
7
|
};
|
|
@@ -1,63 +1,24 @@
|
|
|
1
|
+
import { defaultDarkPalette, defaultLightPalette } from "@tamagui/themes/v5";
|
|
1
2
|
import type { BaseThemeBuilderDefinition } from "../createThemes";
|
|
2
3
|
|
|
4
|
+
// The default is Tamagui's v5 ramp.
|
|
3
5
|
export const defaultBaseTheme: BaseThemeBuilderDefinition = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
// component/hover steps (3-5), borders (6-8), solid/muted (9-10),
|
|
7
|
-
// readable text (11-12).
|
|
8
|
-
//
|
|
9
|
-
// Step 10 (muted-ink tier) is the catalog's de-facto "muted text" step —
|
|
10
|
-
// placeholderColor, and ~20 components/stories set `color="$color10"` on
|
|
11
|
-
// hints, captions, counts, subtitles and placeholders (UX-P01/UX-015).
|
|
12
|
-
// At its old lightness (light 52% / dark 48%) it measured 3.76–3.98:1 on
|
|
13
|
-
// color1/color2 — under the AA 4.5:1 floor for normal text (Axiom 12
|
|
14
|
-
// LEGIBLE FLOOR). Re-anchored to light 46% / dark 54%, the lowest change
|
|
15
|
-
// that clears 4.5:1 on BOTH page surfaces in both schemes (light 4.9/4.7,
|
|
16
|
-
// dark 4.8/4.6) while staying a distinct tier above color11. Its non-text
|
|
17
|
-
// roles (boundary rings, spinners, slider thumb — all ≥3:1 targets) only
|
|
18
|
-
// gain contrast, so the shift is one-directional safe.
|
|
19
|
-
darkPalette: [
|
|
20
|
-
"hsla(270, 6%, 8.7%, 1)",
|
|
21
|
-
"hsla(270, 6%, 10.5%, 1)",
|
|
22
|
-
"hsla(270, 6%, 13.5%, 1)",
|
|
23
|
-
"hsla(270, 6%, 16%, 1)",
|
|
24
|
-
"hsla(270, 6%, 18.5%, 1)",
|
|
25
|
-
"hsla(270, 6%, 21.5%, 1)",
|
|
26
|
-
"hsla(270, 6%, 25.5%, 1)",
|
|
27
|
-
"hsla(270, 6%, 32%, 1)",
|
|
28
|
-
"hsla(270, 6%, 43%, 1)",
|
|
29
|
-
"hsla(270, 6%, 54%, 1)",
|
|
30
|
-
"hsla(270, 6%, 62.5%, 1)",
|
|
31
|
-
"hsla(270, 6%, 94%, 1)",
|
|
32
|
-
],
|
|
33
|
-
lightPalette: [
|
|
34
|
-
"hsla(270, 6%, 99.5%, 1)",
|
|
35
|
-
"hsla(270, 6%, 98.2%, 1)",
|
|
36
|
-
"hsla(270, 6%, 95.2%, 1)",
|
|
37
|
-
"hsla(270, 6%, 92.5%, 1)",
|
|
38
|
-
"hsla(270, 6%, 90%, 1)",
|
|
39
|
-
"hsla(270, 6%, 87%, 1)",
|
|
40
|
-
"hsla(270, 6%, 82.5%, 1)",
|
|
41
|
-
"hsla(270, 6%, 75%, 1)",
|
|
42
|
-
"hsla(270, 6%, 56.5%, 1)",
|
|
43
|
-
"hsla(270, 6%, 46%, 1)",
|
|
44
|
-
"hsla(270, 6%, 40%, 1)",
|
|
45
|
-
"hsla(270, 6%, 14%, 1)",
|
|
46
|
-
],
|
|
6
|
+
lightPalette: [...defaultLightPalette],
|
|
7
|
+
darkPalette: [...defaultDarkPalette],
|
|
47
8
|
lightShadows: {
|
|
48
9
|
shadow1: "rgba(0,0,0,0.04)",
|
|
49
10
|
shadow2: "rgba(0,0,0,0.08)",
|
|
50
|
-
shadow3: "rgba(0,0,0,0.
|
|
51
|
-
shadow4: "rgba(0,0,0,0.
|
|
52
|
-
shadow5: "rgba(0,0,0,0.
|
|
53
|
-
shadow6: "rgba(0,0,0,0.
|
|
11
|
+
shadow3: "rgba(0,0,0,0.12)",
|
|
12
|
+
shadow4: "rgba(0,0,0,0.22)",
|
|
13
|
+
shadow5: "rgba(0,0,0,0.33)",
|
|
14
|
+
shadow6: "rgba(0,0,0,0.44)",
|
|
54
15
|
},
|
|
55
16
|
darkShadows: {
|
|
56
|
-
shadow1: "rgba(0,0,0,0.
|
|
57
|
-
shadow2: "rgba(0,0,0,0.
|
|
58
|
-
shadow3: "rgba(0,0,0,0.
|
|
59
|
-
shadow4: "rgba(0,0,0,0.
|
|
60
|
-
shadow5: "rgba(0,0,0,0.
|
|
61
|
-
shadow6: "rgba(0,0,0,0.
|
|
17
|
+
shadow1: "rgba(0,0,0,0.15)",
|
|
18
|
+
shadow2: "rgba(0,0,0,0.23)",
|
|
19
|
+
shadow3: "rgba(0,0,0,0.33)",
|
|
20
|
+
shadow4: "rgba(0,0,0,0.45)",
|
|
21
|
+
shadow5: "rgba(0,0,0,0.65)",
|
|
22
|
+
shadow6: "rgba(0,0,0,0.8)",
|
|
62
23
|
},
|
|
63
24
|
};
|