@tamagui/theme-base 1.0.1-beta.140 → 1.0.1-beta.143

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.
@@ -2,9 +2,7 @@ import {
2
2
  blue,
3
3
  blueDark,
4
4
  gray,
5
- grayA,
6
5
  grayDark,
7
- grayDarkA,
8
6
  green,
9
7
  greenDark,
10
8
  orange,
@@ -15,10 +13,6 @@ import {
15
13
  purpleDark,
16
14
  red,
17
15
  redDark,
18
- teal,
19
- tealDark,
20
- violet,
21
- violetDark,
22
16
  yellow,
23
17
  yellowDark
24
18
  } from "@tamagui/colors";
@@ -80,55 +74,43 @@ const colorTokens = {
80
74
  light: {
81
75
  blue,
82
76
  gray,
83
- grayA,
84
77
  green,
85
78
  orange,
86
79
  pink,
87
80
  purple,
88
81
  red,
89
- violet,
90
- yellow,
91
- teal
82
+ yellow
92
83
  },
93
84
  dark: {
94
85
  blue: blueDark,
95
86
  gray: grayDark,
96
- grayA: grayDarkA,
97
87
  green: greenDark,
98
88
  orange: orangeDark,
99
89
  pink: pinkDark,
100
90
  purple: purpleDark,
101
91
  red: redDark,
102
- violet: violetDark,
103
- yellow: yellowDark,
104
- teal: tealDark
92
+ yellow: yellowDark
105
93
  }
106
94
  };
107
95
  const darkColors = {
108
96
  ...colorTokens.dark.blue,
109
97
  ...colorTokens.dark.gray,
110
- ...colorTokens.dark.grayA,
111
98
  ...colorTokens.dark.green,
112
99
  ...colorTokens.dark.orange,
113
100
  ...colorTokens.dark.pink,
114
101
  ...colorTokens.dark.purple,
115
102
  ...colorTokens.dark.red,
116
- ...colorTokens.dark.violet,
117
- ...colorTokens.dark.yellow,
118
- ...colorTokens.dark.teal
103
+ ...colorTokens.dark.yellow
119
104
  };
120
105
  const lightColors = {
121
106
  ...colorTokens.light.blue,
122
107
  ...colorTokens.light.gray,
123
- ...colorTokens.light.grayA,
124
108
  ...colorTokens.light.green,
125
109
  ...colorTokens.light.orange,
126
110
  ...colorTokens.light.pink,
127
111
  ...colorTokens.light.purple,
128
112
  ...colorTokens.light.red,
129
- ...colorTokens.light.violet,
130
- ...colorTokens.light.yellow,
131
- ...colorTokens.light.teal
113
+ ...colorTokens.light.yellow
132
114
  };
133
115
  const allColors = {
134
116
  ...postfixObjKeys(lightColors, "Light"),
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/tokens.tsx"],
4
- "sourcesContent": ["import {\n blue,\n blueDark,\n gray,\n grayA,\n grayDark,\n grayDarkA,\n green,\n greenDark,\n orange,\n orangeDark,\n pink,\n pinkDark,\n purple,\n purpleDark,\n red,\n redDark,\n teal,\n tealDark,\n violet,\n violetDark,\n yellow,\n yellowDark,\n} from '@tamagui/colors'\nimport { Variable, createTokens } from '@tamagui/core'\n\n// should roughly map to button/input etc height at each level\n// fonts should match that height/lineHeight at each stop\n// so these are really non-linear on purpose\n// why?\n// - at sizes <1, used for fine grained things (borders, smallest paddingY)\n// - so smallest padY should be roughly 1-4px so it can join with lineHeight\n// - at sizes >=1, have to consider \"pressability\" (jumps up)\n// - after that it should go upwards somewhat naturally\n// - H1 / headings top out at 10 naturally, so after 10 we can go upwards faster\n// but also one more wrinkle...\n// space is used in conjunction with size\n// i'm setting space to generally just a fixed fraction of size (~1/3-2/3 still fine tuning)\nconst size = {\n 0: 0,\n 0.25: 2,\n 0.5: 4,\n 0.75: 8,\n 1: 20,\n 1.5: 24,\n 2: 28,\n 2.5: 32,\n 3: 36,\n 3.5: 40,\n 4: 44,\n true: 44,\n 4.5: 48,\n 5: 52,\n 5.5: 59,\n 6: 64,\n 6.5: 69,\n 7: 74,\n 7.6: 79,\n 8: 84,\n 8.5: 89,\n 9: 94,\n 9.5: 99,\n 10: 104,\n 11: 124,\n 12: 144,\n 13: 164,\n 14: 184,\n 15: 204,\n 16: 224,\n 17: 224,\n 18: 244,\n 19: 264,\n 20: 284,\n}\n\ntype Sizes = typeof size\ntype SizeKeys = `${keyof Sizes}`\n\nconst spaces = Object.entries(size).map(([k, v]) => [\n k,\n Math.max(0, v <= 16 ? Math.round(v * 0.333) : Math.floor(v * 0.7 - 12)),\n])\n\nconst spacesNegative = spaces.map(([k, v]) => [`-${k}`, -v])\n\nconst space: {\n [Key in `-${SizeKeys}` | SizeKeys]: Key extends keyof Sizes ? Sizes[Key] : number\n} = {\n ...Object.fromEntries(spaces),\n ...Object.fromEntries(spacesNegative),\n} as any\n\nconst zIndex = {\n 0: 0,\n 1: 100,\n 2: 200,\n 3: 300,\n 4: 400,\n 5: 500,\n}\n\nconst colorTokens = {\n light: {\n blue: blue,\n gray: gray,\n grayA: grayA,\n green: green,\n orange: orange,\n pink: pink,\n purple: purple,\n red: red,\n violet: violet,\n yellow: yellow,\n teal: teal,\n },\n dark: {\n blue: blueDark,\n gray: grayDark,\n grayA: grayDarkA,\n green: greenDark,\n orange: orangeDark,\n pink: pinkDark,\n purple: purpleDark,\n red: redDark,\n violet: violetDark,\n yellow: yellowDark,\n teal: tealDark,\n },\n}\n\nexport const darkColors = {\n ...colorTokens.dark.blue,\n ...colorTokens.dark.gray,\n ...colorTokens.dark.grayA,\n ...colorTokens.dark.green,\n ...colorTokens.dark.orange,\n ...colorTokens.dark.pink,\n ...colorTokens.dark.purple,\n ...colorTokens.dark.red,\n ...colorTokens.dark.violet,\n ...colorTokens.dark.yellow,\n ...colorTokens.dark.teal,\n}\n\nexport const lightColors = {\n ...colorTokens.light.blue,\n ...colorTokens.light.gray,\n ...colorTokens.light.grayA,\n ...colorTokens.light.green,\n ...colorTokens.light.orange,\n ...colorTokens.light.pink,\n ...colorTokens.light.purple,\n ...colorTokens.light.red,\n ...colorTokens.light.violet,\n ...colorTokens.light.yellow,\n ...colorTokens.light.teal,\n}\n\nconst allColors = {\n ...postfixObjKeys(lightColors, 'Light'),\n ...postfixObjKeys(darkColors, 'Dark'),\n}\n\nfunction postfixObjKeys<A extends { [key: string]: Variable<string> | string }, B extends string>(\n obj: A,\n postfix: B\n): {\n [Key in `${keyof A extends string ? keyof A : never}${B}`]: Variable<string> | string\n} {\n return Object.fromEntries(Object.entries(obj).map(([k, v]) => [`${k}${postfix}`, v])) as any\n}\n\nconst radius = {\n 0: 0,\n 1: 3,\n 2: 5,\n 3: 7,\n 4: 9,\n 5: 10,\n 6: 16,\n 7: 19,\n 8: 22,\n 9: 26,\n 10: 34,\n 11: 42,\n 12: 50,\n}\n\nexport const tokens = createTokens({\n color: allColors,\n radius,\n zIndex,\n space,\n size,\n})\n"],
5
- "mappings": "AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAwBA;AAcA,MAAM,OAAO;AAAA,EACX,GAAG;AAAA,EACH,MAAM;AAAA,EACN,KAAK;AAAA,EACL,MAAM;AAAA,EACN,GAAG;AAAA,EACH,KAAK;AAAA,EACL,GAAG;AAAA,EACH,KAAK;AAAA,EACL,GAAG;AAAA,EACH,KAAK;AAAA,EACL,GAAG;AAAA,EACH,MAAM;AAAA,EACN,KAAK;AAAA,EACL,GAAG;AAAA,EACH,KAAK;AAAA,EACL,GAAG;AAAA,EACH,KAAK;AAAA,EACL,GAAG;AAAA,EACH,KAAK;AAAA,EACL,GAAG;AAAA,EACH,KAAK;AAAA,EACL,GAAG;AAAA,EACH,KAAK;AAAA,EACL,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN;AAKA,MAAM,SAAS,OAAO,QAAQ,IAAI,EAAE,IAAI,CAAC,CAAC,GAAG,OAAO;AAAA,EAClD;AAAA,EACA,KAAK,IAAI,GAAG,KAAK,KAAK,KAAK,MAAM,IAAI,KAAK,IAAI,KAA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Y,MAAM;AAAA,EACrB,GAAG,YAAY,MAAM;AAAA,EACrB,GAAG,YAAY,MAAM;AAAA,EACrB,GAAG,YAAY,MAAM;AAAA,EACrB,GAAG,YAAY,MAAM;AAAA,EACrB,GAAG,YAAY,MAAM;AAAA,EACrB,GAAG,YAAY,MAAM;AAAA,EACrB,GAAG,YAAY,MAAM;AACvB;AAEA,MAAM,YAAY;AAAA,EAChB,GAAG,eAAe,aAAa,OAAO;AAAA,EACtC,GAAG,eAAe,YAAY,MAAM;AACtC;AAEA,wBACE,KACA,SAGA;AACA,SAAO,OAAO,YAAY,OAAO,QAAQ,GAAG,EAAE,IAAI,CAAC,CAAC,GAAG,OAAO,CAAC,GAAG,IAAI,WAAW,CAAC,CAAC,CAAC;AACtF;AAEA,MAAM,SAAS;AAAA,EACb,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN;AAEO,MAAM,SAAS,aAAa;AAAA,EACjC,OAAO;AAAA,EACP;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;",
4
+ "sourcesContent": ["import {\n blue,\n blueDark,\n gray,\n grayDark,\n green,\n greenDark,\n orange,\n orangeDark,\n pink,\n pinkDark,\n purple,\n purpleDark,\n red,\n redDark,\n yellow,\n yellowDark,\n} from '@tamagui/colors'\nimport { Variable, createTokens } from '@tamagui/core'\n\n// should roughly map to button/input etc height at each level\n// fonts should match that height/lineHeight at each stop\n// so these are really non-linear on purpose\n// why?\n// - at sizes <1, used for fine grained things (borders, smallest paddingY)\n// - so smallest padY should be roughly 1-4px so it can join with lineHeight\n// - at sizes >=1, have to consider \"pressability\" (jumps up)\n// - after that it should go upwards somewhat naturally\n// - H1 / headings top out at 10 naturally, so after 10 we can go upwards faster\n// but also one more wrinkle...\n// space is used in conjunction with size\n// i'm setting space to generally just a fixed fraction of size (~1/3-2/3 still fine tuning)\nconst size = {\n 0: 0,\n 0.25: 2,\n 0.5: 4,\n 0.75: 8,\n 1: 20,\n 1.5: 24,\n 2: 28,\n 2.5: 32,\n 3: 36,\n 3.5: 40,\n 4: 44,\n true: 44,\n 4.5: 48,\n 5: 52,\n 5.5: 59,\n 6: 64,\n 6.5: 69,\n 7: 74,\n 7.6: 79,\n 8: 84,\n 8.5: 89,\n 9: 94,\n 9.5: 99,\n 10: 104,\n 11: 124,\n 12: 144,\n 13: 164,\n 14: 184,\n 15: 204,\n 16: 224,\n 17: 224,\n 18: 244,\n 19: 264,\n 20: 284,\n}\n\ntype Sizes = typeof size\ntype SizeKeys = `${keyof Sizes}`\n\nconst spaces = Object.entries(size).map(([k, v]) => [\n k,\n Math.max(0, v <= 16 ? Math.round(v * 0.333) : Math.floor(v * 0.7 - 12)),\n])\n\nconst spacesNegative = spaces.map(([k, v]) => [`-${k}`, -v])\n\nconst space: {\n [Key in `-${SizeKeys}` | SizeKeys]: Key extends keyof Sizes ? Sizes[Key] : number\n} = {\n ...Object.fromEntries(spaces),\n ...Object.fromEntries(spacesNegative),\n} as any\n\nconst zIndex = {\n 0: 0,\n 1: 100,\n 2: 200,\n 3: 300,\n 4: 400,\n 5: 500,\n}\n\nconst colorTokens = {\n light: {\n blue: blue,\n gray: gray,\n green: green,\n orange: orange,\n pink: pink,\n purple: purple,\n red: red,\n yellow: yellow,\n },\n dark: {\n blue: blueDark,\n gray: grayDark,\n green: greenDark,\n orange: orangeDark,\n pink: pinkDark,\n purple: purpleDark,\n red: redDark,\n yellow: yellowDark,\n },\n}\n\nexport const darkColors = {\n ...colorTokens.dark.blue,\n ...colorTokens.dark.gray,\n ...colorTokens.dark.green,\n ...colorTokens.dark.orange,\n ...colorTokens.dark.pink,\n ...colorTokens.dark.purple,\n ...colorTokens.dark.red,\n ...colorTokens.dark.yellow,\n}\n\nexport const lightColors = {\n ...colorTokens.light.blue,\n ...colorTokens.light.gray,\n ...colorTokens.light.green,\n ...colorTokens.light.orange,\n ...colorTokens.light.pink,\n ...colorTokens.light.purple,\n ...colorTokens.light.red,\n ...colorTokens.light.yellow,\n}\n\nconst allColors = {\n ...postfixObjKeys(lightColors, 'Light'),\n ...postfixObjKeys(darkColors, 'Dark'),\n}\n\nfunction postfixObjKeys<A extends { [key: string]: Variable<string> | string }, B extends string>(\n obj: A,\n postfix: B\n): {\n [Key in `${keyof A extends string ? keyof A : never}${B}`]: Variable<string> | string\n} {\n return Object.fromEntries(Object.entries(obj).map(([k, v]) => [`${k}${postfix}`, v])) as any\n}\n\nconst radius = {\n 0: 0,\n 1: 3,\n 2: 5,\n 3: 7,\n 4: 9,\n 5: 10,\n 6: 16,\n 7: 19,\n 8: 22,\n 9: 26,\n 10: 34,\n 11: 42,\n 12: 50,\n}\n\nexport const tokens = createTokens({\n color: allColors,\n radius,\n zIndex,\n space,\n size,\n})\n"],
5
+ "mappings": "AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAkBA;AAcA,MAAM,OAAO;AAAA,EACX,GAAG;AAAA,EACH,MAAM;AAAA,EACN,KAAK;AAAA,EACL,MAAM;AAAA,EACN,GAAG;AAAA,EACH,KAAK;AAAA,EACL,GAAG;AAAA,EACH,KAAK;AAAA,EACL,GAAG;AAAA,EACH,KAAK;AAAA,EACL,GAAG;AAAA,EACH,MAAM;AAAA,EACN,KAAK;AAAA,EACL,GAAG;AAAA,EACH,KAAK;AAAA,EACL,GAAG;AAAA,EACH,KAAK;AAAA,EACL,GAAG;AAAA,EACH,KAAK;AAAA,EACL,GAAG;AAAA,EACH,KAAK;AAAA,EACL,GAAG;AAAA,EACH,KAAK;AAAA,EACL,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EAC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A,EACzB,GAAG,YAAY,MAAM;AAAA,EACrB,GAAG,YAAY,MAAM;AAAA,EACrB,GAAG,YAAY,MAAM;AAAA,EACrB,GAAG,YAAY,MAAM;AAAA,EACrB,GAAG,YAAY,MAAM;AAAA,EACrB,GAAG,YAAY,MAAM;AAAA,EACrB,GAAG,YAAY,MAAM;AAAA,EACrB,GAAG,YAAY,MAAM;AACvB;AAEA,MAAM,YAAY;AAAA,EAChB,GAAG,eAAe,aAAa,OAAO;AAAA,EACtC,GAAG,eAAe,YAAY,MAAM;AACtC;AAEA,wBACE,KACA,SAGA;AACA,SAAO,OAAO,YAAY,OAAO,QAAQ,GAAG,EAAE,IAAI,CAAC,CAAC,GAAG,OAAO,CAAC,GAAG,IAAI,WAAW,CAAC,CAAC,CAAC;AACtF;AAEA,MAAM,SAAS;AAAA,EACb,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN;AAEO,MAAM,SAAS,aAAa;AAAA,EACjC,OAAO;AAAA,EACP;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;",
6
6
  "names": []
7
7
  }
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@tamagui/theme-base",
3
- "version": "1.0.1-beta.140",
3
+ "version": "1.0.1-beta.143",
4
4
  "types": "./types/index.d.ts",
5
5
  "main": "dist/cjs",
6
6
  "module": "dist/esm",
7
- "module:jsx": "dist/jsx",
7
+ "sideEffects": false,
8
8
  "files": [
9
9
  "src",
10
10
  "types",
@@ -18,12 +18,19 @@
18
18
  "clean": "tamagui-build clean",
19
19
  "clean:build": "tamagui-build clean:build"
20
20
  },
21
+ "exports": {
22
+ "./package.json": "./package.json",
23
+ ".": {
24
+ "import": "./dist/esm/index.js",
25
+ "require": "./dist/cjs/index.js"
26
+ }
27
+ },
21
28
  "dependencies": {
22
- "@tamagui/colors": "^1.0.1-beta.140",
23
- "@tamagui/core": "^1.0.1-beta.140"
29
+ "@tamagui/colors": "^1.0.1-beta.143",
30
+ "@tamagui/core": "^1.0.1-beta.143"
24
31
  },
25
32
  "devDependencies": {
26
- "@tamagui/build": "^1.0.1-beta.140"
33
+ "@tamagui/build": "^1.0.1-beta.143"
27
34
  },
28
35
  "publishConfig": {
29
36
  "access": "public"
package/src/themes.tsx CHANGED
@@ -1,9 +1,7 @@
1
1
  import { Variable, createTheme, getVariableValue, isWeb } from '@tamagui/core'
2
2
 
3
3
  import { setColorAlpha } from './colorUtils'
4
- import { darkColors, lightColors, tokens } from './tokens'
5
-
6
- const { color } = tokens
4
+ import { darkColors, lightColors } from './tokens'
7
5
 
8
6
  // spaghetti ahead
9
7
 
@@ -25,12 +23,36 @@ type ThemeCreatorProps = {
25
23
 
26
24
  // helpers
27
25
 
28
- const alternates = [1, 2, 3, 4] as const
29
- const alts = [1, 2, 3] as const
30
- type AltKeys = 1 | 2 | 3
26
+ const alternates = [1, 2, 3] as const
27
+ const alts = [1, 2] as const
28
+ type AltKeys = 1 | 2
31
29
  type AltName<Name extends string, Keys extends string | number> = `${Name}_alt${Keys}`
32
30
  type ThemeCreator<A = any> = (str: number, props: ThemeCreatorProps) => A
33
31
 
32
+ interface SubTheme {
33
+ background: Variable<any> | string
34
+ backgroundStrong: Variable<any> | string
35
+ backgroundSoft: Variable<any> | string
36
+ backgroundHover: Variable<any> | string
37
+ backgroundPress: Variable<any> | string
38
+ backgroundFocus: Variable<any> | string
39
+ backgroundTransparent: Variable<any> | string
40
+ color: Variable<any> | string
41
+ colorHover: Variable<any> | string
42
+ colorPress: Variable<any> | string
43
+ colorFocus: Variable<any> | string
44
+ colorTranslucent: Variable<any> | string
45
+ colorMid: Variable<any> | string
46
+ shadowColor: Variable<any> | string
47
+ shadowColorHover: Variable<any> | string
48
+ shadowColorPress: Variable<any> | string
49
+ shadowColorFocus: Variable<any> | string
50
+ borderColor: Variable<any> | string
51
+ borderColorHover: Variable<any> | string
52
+ borderColorPress: Variable<any> | string
53
+ borderColorFocus: Variable<any> | string
54
+ }
55
+
34
56
  function createThemesFrom<Name extends string, GetTheme extends ThemeCreator = ThemeCreator>(
35
57
  name: Name,
36
58
  getTheme: GetTheme,
@@ -91,8 +113,8 @@ function createThemesFrom<Name extends string, GetTheme extends ThemeCreator = T
91
113
  ...altButtonThemes.slice(0, alts.length),
92
114
  [`${name}_Button`, altThemes2[1][1]],
93
115
  [`${name}_DrawerFrame`, altThemes2[1][1]],
94
- [`${name}_SliderTrack`, altThemes[2][1]],
95
- [`${name}_SliderTrackActive`, altThemes[3][1]],
116
+ [`${name}_SliderTrack`, altThemes[0][1]],
117
+ [`${name}_SliderTrackActive`, altThemes[2][1]],
96
118
  [`${name}_SliderThumb`, inverted[2]],
97
119
  [`${name}_Progress`, altThemes[2][1]],
98
120
  [`${name}_ProgressIndicator`, inverted[2]],
@@ -138,21 +160,21 @@ const themeCreator = (
138
160
 
139
161
  const colorTranslucent = setColorAlpha(getVariableValue(get(colors, 0 + str, 'color')), 0.5)
140
162
 
141
- const theme = {
163
+ const theme: SubTheme = {
142
164
  background: get(backgrounds, str),
143
165
  backgroundStrong: backgroundStrong || get(backgrounds, str + strongerDir * 2),
144
166
  backgroundSoft: get(backgrounds, str + softerDir * 2),
145
167
  backgroundHover: get(backgrounds, str + lighterDir),
146
168
  backgroundPress: get(backgrounds, str + darkerDir),
147
169
  backgroundFocus: get(backgrounds, str + darkerDir * 2),
148
- backgroundTransparent: color.grayA1Light,
170
+ backgroundTransparent: 'hsla(0, 0%, 0%, 0.012)',
149
171
  color: get(colors, 0 + str, 'color'),
150
172
  colorHover: get(colors, 1 + str, 'color'),
151
173
  colorPress: get(colors, 2 + str, 'color'),
152
174
  colorFocus: get(colors, 3 + str, 'color'),
153
175
  colorTranslucent,
154
176
  colorMid: (isLight ? colors : backgrounds)[Math.floor(colors.length / 2)],
155
- shadowColor: isLight ? color.grayA2Light : color.grayA8Light,
177
+ shadowColor: isLight ? 'hsla(0, 0%, 0%, 0.03)' : 'hsla(0, 0%, 0%, 0.2)',
156
178
  shadowColorHover: darkColors[!isLight ? 1 : 8],
157
179
  shadowColorPress: darkColors[!isLight ? 1 : 8],
158
180
  shadowColorFocus: darkColors[!isLight ? 1 : 8],
@@ -210,18 +232,18 @@ const themeColors = {
210
232
  light: [
211
233
  '#fff',
212
234
  '#f4f4f4',
213
- color.gray1Light,
214
- color.gray2Light,
215
- color.gray3Light,
216
- color.gray4Light,
217
- color.gray5Light,
218
- color.gray6Light,
219
- color.gray7Light,
220
- color.gray8Light,
221
- color.gray9Light,
222
- color.gray10Light,
223
- color.gray11Light,
224
- color.gray12Light,
235
+ 'hsl(0, 0%, 99.0%)',
236
+ 'hsl(0, 0%, 97.3%)',
237
+ 'hsl(0, 0%, 95.1%)',
238
+ 'hsl(0, 0%, 93.0%)',
239
+ 'hsl(0, 0%, 90.9%)',
240
+ 'hsl(0, 0%, 88.7%)',
241
+ 'hsl(0, 0%, 85.8%)',
242
+ 'hsl(0, 0%, 78.0%)',
243
+ 'hsl(0, 0%, 56.1%)',
244
+ 'hsl(0, 0%, 52.3%)',
245
+ 'hsl(0, 0%, 43.5%)',
246
+ 'hsl(0, 0%, 9.0%)',
225
247
  ],
226
248
  dark: [
227
249
  '#111111',
@@ -265,19 +287,19 @@ const darkThemes = createThemesFrom('dark', themeCreator, {
265
287
  darkThemes.dark_darker.background = '#030303'
266
288
  darkThemes.dark_darker.backgroundStrong = '#000'
267
289
 
290
+ type BaseTheme = {
291
+ [key in keyof typeof lightColors | keyof SubTheme]: Variable<string>
292
+ }
293
+
268
294
  const light = createTheme({
269
295
  ...lightColors,
270
296
  ...lightThemes.light,
271
- })
297
+ }) as BaseTheme
272
298
 
273
299
  const dark = createTheme({
274
300
  ...darkColors,
275
301
  ...darkThemes.dark,
276
- })
277
-
278
- type ThemeBase = {
279
- [Key in keyof typeof dark]: string
280
- }
302
+ }) as BaseTheme
281
303
 
282
304
  const baseThemes = {
283
305
  // light
@@ -286,9 +308,9 @@ const baseThemes = {
286
308
  // reserving in types, updating later
287
309
  light_active: lightThemes.light,
288
310
  light_Card: lightThemes.light,
289
- light_SliderTrack: lightThemes.light_alt2,
290
- light_SliderTrackActive: lightThemes.light_alt3,
291
- light_Switch: lightThemes.light_alt3,
311
+ light_SliderTrack: lightThemes.light_alt1,
312
+ light_SliderTrackActive: lightThemes.light_alt2,
313
+ light_Switch: lightThemes.light_alt2,
292
314
  light_SwitchThumb: lightThemes.light,
293
315
  light_DrawerFrame: lightThemes.light_alt1,
294
316
 
@@ -298,17 +320,17 @@ const baseThemes = {
298
320
  // reserving in types, updating later
299
321
  dark_active: darkThemes.dark,
300
322
  dark_Card: darkThemes.dark,
301
- dark_DrawerFrame: darkThemes.dark_alt2,
323
+ dark_DrawerFrame: darkThemes.dark_alt1,
302
324
  dark_SliderTrack: darkThemes.dark_darker,
303
- dark_SliderTrackActive: darkThemes.dark_alt3,
304
- dark_Switch: darkThemes.dark_alt3,
325
+ dark_SliderTrackActive: darkThemes.dark_alt2,
326
+ dark_Switch: darkThemes.dark_alt2,
305
327
  dark_SwitchThumb: darkThemes.dark_darker,
306
328
  dark_Button: darkThemes.dark_alt1,
307
329
  }
308
330
 
309
331
  const darkEntries = Object.entries(dark)
310
332
  const lightEntries = Object.entries(light)
311
- function findColors(prefix: string, dark = false): ThemeBase {
333
+ function findColors(prefix: string, dark = false): BaseTheme {
312
334
  return Object.fromEntries(
313
335
  (dark ? darkEntries : lightEntries).filter(([k]) => k.startsWith(prefix))
314
336
  ) as any
@@ -323,7 +345,6 @@ export const colorSchemes = [
323
345
  { name: 'purple', colors: findColors('purple'), darkColors: findColors('purple', true) },
324
346
  { name: 'red', colors: findColors('red'), darkColors: findColors('red', true) },
325
347
  { name: 'yellow', colors: findColors('yellow'), darkColors: findColors('yellow', true) },
326
- { name: 'teal', colors: findColors('teal'), darkColors: findColors('teal', true) },
327
348
  ] as const
328
349
 
329
350
  export type ColorNames = typeof colorSchemes[number]['name']
@@ -331,14 +352,13 @@ export type ColorNames = typeof colorSchemes[number]['name']
331
352
  // nice and flat
332
353
  export const colorNames: ColorNames[] = [
333
354
  'blue',
334
- 'gray',
335
355
  'green',
336
356
  'orange',
337
357
  'pink',
338
358
  'purple',
339
359
  'red',
340
360
  'yellow',
341
- 'teal',
361
+ 'gray',
342
362
  ]
343
363
 
344
364
  type ColorThemeNames =
@@ -367,8 +387,11 @@ const colorThemeEntries = colorSchemes.flatMap(({ name, colors, darkColors }) =>
367
387
  // }
368
388
 
369
389
  const themeWithAlts = createThemesFrom(name, themeCreator, {
390
+ // @ts-ignore
370
391
  colors,
392
+ // @ts-ignore
371
393
  backgrounds,
394
+ // @ts-ignore
372
395
  borderColors: backgrounds,
373
396
  isLight,
374
397
  shift,
@@ -385,15 +408,19 @@ const colorThemeEntries = colorSchemes.flatMap(({ name, colors, darkColors }) =>
385
408
  return [...altLightThemes, ...altDarkThemes]
386
409
  })
387
410
 
388
- type MyThemeBase = typeof baseThemes['light_alt1']
411
+ type TypedColorTheme = typeof lightThemes.light_alt1
412
+ type TypedTheme = typeof light
413
+ type TypedThemes = {
414
+ [key in keyof typeof allThemes]: TypedTheme
415
+ }
389
416
 
390
417
  const colorThemes: {
391
- [key in ColorThemeNames]: MyThemeBase
418
+ [key in ColorThemeNames]: TypedColorTheme
392
419
  } = Object.fromEntries(colorThemeEntries) as any
393
420
 
394
421
  // add in base _active themes
395
422
  baseThemes.dark_active = {
396
- ...colorThemes.dark_blue_alt3,
423
+ ...colorThemes.dark_blue_alt2,
397
424
  background: darkColors.blue10,
398
425
  backgroundHover: darkColors.blue11,
399
426
  backgroundPress: darkColors.blue9,
@@ -412,6 +439,4 @@ const allThemes = {
412
439
  ...colorThemes,
413
440
  } as const
414
441
 
415
- export const themes: {
416
- [key in keyof typeof allThemes]: typeof baseThemes['light']
417
- } = allThemes as any
442
+ export const themes: TypedThemes = allThemes as any
package/src/tokens.tsx CHANGED
@@ -2,9 +2,7 @@ import {
2
2
  blue,
3
3
  blueDark,
4
4
  gray,
5
- grayA,
6
5
  grayDark,
7
- grayDarkA,
8
6
  green,
9
7
  greenDark,
10
8
  orange,
@@ -15,10 +13,6 @@ import {
15
13
  purpleDark,
16
14
  red,
17
15
  redDark,
18
- teal,
19
- tealDark,
20
- violet,
21
- violetDark,
22
16
  yellow,
23
17
  yellowDark,
24
18
  } from '@tamagui/colors'
@@ -103,57 +97,45 @@ const colorTokens = {
103
97
  light: {
104
98
  blue: blue,
105
99
  gray: gray,
106
- grayA: grayA,
107
100
  green: green,
108
101
  orange: orange,
109
102
  pink: pink,
110
103
  purple: purple,
111
104
  red: red,
112
- violet: violet,
113
105
  yellow: yellow,
114
- teal: teal,
115
106
  },
116
107
  dark: {
117
108
  blue: blueDark,
118
109
  gray: grayDark,
119
- grayA: grayDarkA,
120
110
  green: greenDark,
121
111
  orange: orangeDark,
122
112
  pink: pinkDark,
123
113
  purple: purpleDark,
124
114
  red: redDark,
125
- violet: violetDark,
126
115
  yellow: yellowDark,
127
- teal: tealDark,
128
116
  },
129
117
  }
130
118
 
131
119
  export const darkColors = {
132
120
  ...colorTokens.dark.blue,
133
121
  ...colorTokens.dark.gray,
134
- ...colorTokens.dark.grayA,
135
122
  ...colorTokens.dark.green,
136
123
  ...colorTokens.dark.orange,
137
124
  ...colorTokens.dark.pink,
138
125
  ...colorTokens.dark.purple,
139
126
  ...colorTokens.dark.red,
140
- ...colorTokens.dark.violet,
141
127
  ...colorTokens.dark.yellow,
142
- ...colorTokens.dark.teal,
143
128
  }
144
129
 
145
130
  export const lightColors = {
146
131
  ...colorTokens.light.blue,
147
132
  ...colorTokens.light.gray,
148
- ...colorTokens.light.grayA,
149
133
  ...colorTokens.light.green,
150
134
  ...colorTokens.light.orange,
151
135
  ...colorTokens.light.pink,
152
136
  ...colorTokens.light.purple,
153
137
  ...colorTokens.light.red,
154
- ...colorTokens.light.violet,
155
138
  ...colorTokens.light.yellow,
156
- ...colorTokens.light.teal,
157
139
  }
158
140
 
159
141
  const allColors = {