@tamagui/theme-base 1.0.1-beta.18 → 1.0.1-beta.180
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/colorUtils.js +10 -10
- package/dist/cjs/colorUtils.js.map +1 -1
- package/dist/cjs/index.js +1 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/themes.js +196 -147
- package/dist/cjs/themes.js.map +3 -3
- package/dist/cjs/tokens.js +116 -30
- package/dist/cjs/tokens.js.map +2 -2
- package/dist/esm/colorUtils.js +10 -13
- package/dist/esm/colorUtils.js.map +1 -1
- package/dist/esm/index.js +0 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/themes.js +191 -134
- package/dist/esm/themes.js.map +3 -3
- package/dist/esm/tokens.js +126 -18
- package/dist/esm/tokens.js.map +2 -2
- package/package.json +16 -6
- package/src/colorUtils.tsx +42 -0
- package/src/index.tsx +3 -0
- package/src/themes.tsx +449 -0
- package/src/tokens.tsx +177 -0
- package/types/themes.d.ts +124 -4479
- package/types/tokens.d.ts +657 -197
- package/dist/jsx/colorUtils.js +0 -42
- package/dist/jsx/index.js +0 -3
- package/dist/jsx/themes.js +0 -244
- package/dist/jsx/tokens.js +0 -45
- package/types/colorUtils.d.ts.map +0 -1
- package/types/index.d.ts.map +0 -1
- package/types/themes.d.ts.map +0 -1
- package/types/tokens.d.ts.map +0 -1
package/dist/cjs/colorUtils.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
var __defProp = Object.defineProperty;
|
|
2
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
6
6
|
var __export = (target, all) => {
|
|
7
7
|
for (var name in all)
|
|
8
8
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -23,7 +23,7 @@ __export(colorUtils_exports, {
|
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(colorUtils_exports);
|
|
25
25
|
var import_core = require("@tamagui/core");
|
|
26
|
-
const hexToRGBA =
|
|
26
|
+
const hexToRGBA = (hex, alpha = 1) => {
|
|
27
27
|
if (!isValidHex(hex)) {
|
|
28
28
|
throw new Error("Invalid HEX");
|
|
29
29
|
}
|
|
@@ -31,8 +31,8 @@ const hexToRGBA = /* @__PURE__ */ __name((hex, alpha = 1) => {
|
|
|
31
31
|
const hexArr = getChunksFromString(hex.slice(1), chunkSize);
|
|
32
32
|
const [r, g, b, a] = (hexArr == null ? void 0 : hexArr.map(convertHexUnitTo256)) ?? [];
|
|
33
33
|
return `rgba(${r}, ${g}, ${b}, ${getAlphaFloat(a, alpha)})`;
|
|
34
|
-
}
|
|
35
|
-
const setColorAlpha =
|
|
34
|
+
};
|
|
35
|
+
const setColorAlpha = (colorIn, alpha = 1) => {
|
|
36
36
|
let color = `${(0, import_core.getVariableValue)(colorIn)}`;
|
|
37
37
|
if (color.startsWith("hsl(")) {
|
|
38
38
|
return color.replace("hsl", "hsla").replace(")", `, ${alpha})`);
|
|
@@ -44,11 +44,11 @@ const setColorAlpha = /* @__PURE__ */ __name((colorIn, alpha = 1) => {
|
|
|
44
44
|
return color.replace("rgb", "rgba").replace(")", `, ${alpha})`);
|
|
45
45
|
}
|
|
46
46
|
return color;
|
|
47
|
-
}
|
|
48
|
-
const isValidHex =
|
|
49
|
-
const getChunksFromString =
|
|
50
|
-
const convertHexUnitTo256 =
|
|
51
|
-
const getAlphaFloat =
|
|
47
|
+
};
|
|
48
|
+
const isValidHex = (hex) => /^#([A-Fa-f0-9]{3,4}){1,2}$/.test(hex);
|
|
49
|
+
const getChunksFromString = (st, chunkSize = 0) => st.match(new RegExp(`.{${chunkSize}}`, "g"));
|
|
50
|
+
const convertHexUnitTo256 = (hexStr) => parseInt(hexStr.repeat(2 / hexStr.length), 16);
|
|
51
|
+
const getAlphaFloat = (a, alpha = 1) => {
|
|
52
52
|
if (a !== void 0) {
|
|
53
53
|
return a / 255;
|
|
54
54
|
}
|
|
@@ -56,7 +56,7 @@ const getAlphaFloat = /* @__PURE__ */ __name((a, alpha = 1) => {
|
|
|
56
56
|
return 1;
|
|
57
57
|
}
|
|
58
58
|
return alpha;
|
|
59
|
-
}
|
|
59
|
+
};
|
|
60
60
|
// Annotate the CommonJS export names for ESM import in node:
|
|
61
61
|
0 && (module.exports = {
|
|
62
62
|
hexToRGBA,
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/colorUtils.tsx"],
|
|
4
4
|
"sourcesContent": ["import { Variable, getVariableValue } from '@tamagui/core'\n\nexport const hexToRGBA = (hex: string, alpha = 1) => {\n if (!isValidHex(hex)) {\n throw new Error('Invalid HEX')\n }\n const chunkSize = Math.floor((hex.length - 1) / 3)\n const hexArr = getChunksFromString(hex.slice(1), chunkSize)\n const [r, g, b, a] = hexArr?.map(convertHexUnitTo256) ?? []\n return `rgba(${r}, ${g}, ${b}, ${getAlphaFloat(a, alpha)})`\n}\n\nexport const setColorAlpha = (colorIn: string | Variable, alpha = 1) => {\n let color = `${getVariableValue(colorIn)}`\n if (color.startsWith('hsl(')) {\n return color.replace('hsl', 'hsla').replace(')', `, ${alpha})`)\n }\n if (color.startsWith('#')) {\n return hexToRGBA(color, alpha)\n }\n if (color.startsWith('rgb(')) {\n return color.replace('rgb', 'rgba').replace(')', `, ${alpha})`)\n }\n return color\n}\n\nconst isValidHex = (hex: string) => /^#([A-Fa-f0-9]{3,4}){1,2}$/.test(hex)\n\nconst getChunksFromString = (st: string, chunkSize = 0) =>\n st.match(new RegExp(`.{${chunkSize}}`, 'g'))\n\nconst convertHexUnitTo256 = (hexStr: string) => parseInt(hexStr.repeat(2 / hexStr.length), 16)\n\nconst getAlphaFloat = (a: any, alpha = 1) => {\n if (a !== undefined) {\n return a / 255\n }\n if (typeof alpha != 'number' || alpha < 0 || alpha > 1) {\n return 1\n }\n return alpha\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAA2C;AAEpC,MAAM,YAAY,
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAA2C;AAEpC,MAAM,YAAY,CAAC,KAAa,QAAQ,MAAM;AACnD,MAAI,CAAC,WAAW,GAAG,GAAG;AACpB,UAAM,IAAI,MAAM,aAAa;AAAA,EAC/B;AACA,QAAM,YAAY,KAAK,OAAO,IAAI,SAAS,KAAK,CAAC;AACjD,QAAM,SAAS,oBAAoB,IAAI,MAAM,CAAC,GAAG,SAAS;AAC1D,QAAM,CAAC,GAAG,GAAG,GAAG,CAAC,KAAI,iCAAQ,IAAI,yBAAwB,CAAC;AAC1D,SAAO,QAAQ,MAAM,MAAM,MAAM,cAAc,GAAG,KAAK;AACzD;AAEO,MAAM,gBAAgB,CAAC,SAA4B,QAAQ,MAAM;AACtE,MAAI,QAAQ,OAAG,8BAAiB,OAAO;AACvC,MAAI,MAAM,WAAW,MAAM,GAAG;AAC5B,WAAO,MAAM,QAAQ,OAAO,MAAM,EAAE,QAAQ,KAAK,KAAK,QAAQ;AAAA,EAChE;AACA,MAAI,MAAM,WAAW,GAAG,GAAG;AACzB,WAAO,UAAU,OAAO,KAAK;AAAA,EAC/B;AACA,MAAI,MAAM,WAAW,MAAM,GAAG;AAC5B,WAAO,MAAM,QAAQ,OAAO,MAAM,EAAE,QAAQ,KAAK,KAAK,QAAQ;AAAA,EAChE;AACA,SAAO;AACT;AAEA,MAAM,aAAa,CAAC,QAAgB,6BAA6B,KAAK,GAAG;AAEzE,MAAM,sBAAsB,CAAC,IAAY,YAAY,MACnD,GAAG,MAAM,IAAI,OAAO,KAAK,cAAc,GAAG,CAAC;AAE7C,MAAM,sBAAsB,CAAC,WAAmB,SAAS,OAAO,OAAO,IAAI,OAAO,MAAM,GAAG,EAAE;AAE7F,MAAM,gBAAgB,CAAC,GAAQ,QAAQ,MAAM;AAC3C,MAAI,MAAM,QAAW;AACnB,WAAO,IAAI;AAAA,EACb;AACA,MAAI,OAAO,SAAS,YAAY,QAAQ,KAAK,QAAQ,GAAG;AACtD,WAAO;AAAA,EACT;AACA,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/cjs/index.js
CHANGED
package/dist/cjs/index.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/index.tsx"],
|
|
4
4
|
"sourcesContent": ["export * from './themes'\nexport * from './tokens'\nexport * from '@tamagui/colors'\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,wBAAc,qBAAd;AACA,wBAAc,qBADd;AAEA,wBAAc,4BAFd;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/cjs/themes.js
CHANGED
|
@@ -1,27 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
|
-
var __defProps = Object.defineProperties;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
9
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
11
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
12
|
-
var __spreadValues = (a, b) => {
|
|
13
|
-
for (var prop in b || (b = {}))
|
|
14
|
-
if (__hasOwnProp.call(b, prop))
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
16
|
-
if (__getOwnPropSymbols)
|
|
17
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
18
|
-
if (__propIsEnum.call(b, prop))
|
|
19
|
-
__defNormalProp(a, prop, b[prop]);
|
|
20
|
-
}
|
|
21
|
-
return a;
|
|
22
|
-
};
|
|
23
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
24
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
25
6
|
var __export = (target, all) => {
|
|
26
7
|
for (var name in all)
|
|
27
8
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -34,55 +15,84 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
34
15
|
}
|
|
35
16
|
return to;
|
|
36
17
|
};
|
|
37
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
38
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
39
19
|
var themes_exports = {};
|
|
40
20
|
__export(themes_exports, {
|
|
21
|
+
colorNames: () => colorNames,
|
|
41
22
|
colorSchemes: () => colorSchemes,
|
|
42
|
-
darkGradient: () => darkGradient,
|
|
43
|
-
lightGradient: () => lightGradient,
|
|
44
23
|
themes: () => themes
|
|
45
24
|
});
|
|
46
25
|
module.exports = __toCommonJS(themes_exports);
|
|
47
|
-
var Colors = __toESM(require("@tamagui/colors"));
|
|
48
|
-
var import_colors = require("@tamagui/colors");
|
|
49
26
|
var import_core = require("@tamagui/core");
|
|
50
27
|
var import_colorUtils = require("./colorUtils");
|
|
51
28
|
var import_tokens = require("./tokens");
|
|
52
|
-
const alternates = [1, 2, 3
|
|
29
|
+
const alternates = [1, 2, 3];
|
|
30
|
+
const alts = [1, 2];
|
|
53
31
|
function createThemesFrom(name, getTheme, props) {
|
|
54
32
|
const { shift = 0 } = props;
|
|
55
33
|
const theme = getTheme(0 + shift, props);
|
|
56
34
|
let themeEntries = [[name, theme]];
|
|
57
35
|
const altThemes = alternates.map((alt) => [
|
|
36
|
+
`${name}_alt${alt}`,
|
|
37
|
+
getTheme(alt * 1 + shift, props)
|
|
38
|
+
]);
|
|
39
|
+
const altThemes2 = alternates.map((alt) => [
|
|
58
40
|
`${name}_alt${alt}`,
|
|
59
41
|
getTheme(alt + shift, props)
|
|
60
42
|
]);
|
|
61
43
|
const altButtonThemes = alternates.map((_, i) => {
|
|
62
|
-
const [bName, bTheme] = [
|
|
44
|
+
const [bName, bTheme] = [altThemes2[i][0], (altThemes2[i + 1] || altThemes2[i])[1]];
|
|
63
45
|
return [`${bName}_Button`, bTheme];
|
|
64
46
|
});
|
|
65
47
|
const darkerTheme = getTheme(Math.max(0, shift + (props.isLight ? 1 : -1)), props);
|
|
66
|
-
const activeTheme =
|
|
48
|
+
const activeTheme = props.activeTheme || {
|
|
49
|
+
...theme,
|
|
50
|
+
borderColor: props.backgrounds[7],
|
|
51
|
+
background: props.backgrounds[6],
|
|
52
|
+
backgroundHover: props.backgrounds[6],
|
|
53
|
+
backgroundPress: props.backgrounds[6]
|
|
54
|
+
};
|
|
55
|
+
const inverted = altThemes.map(([_name, theme2]) => {
|
|
56
|
+
return {
|
|
57
|
+
...theme2,
|
|
58
|
+
background: theme2.color,
|
|
59
|
+
backgroundHover: theme2.colorHover,
|
|
60
|
+
backgroundFocus: theme2.colorFocus,
|
|
61
|
+
backgroundPress: theme2.colorPress,
|
|
62
|
+
color: theme2.background,
|
|
63
|
+
colorHover: theme2.backgroundHover,
|
|
64
|
+
colorFocus: theme2.backgroundFocus,
|
|
65
|
+
colorPress: theme2.backgroundPress
|
|
66
|
+
};
|
|
67
|
+
});
|
|
67
68
|
themeEntries = [
|
|
68
69
|
...themeEntries,
|
|
69
|
-
...altThemes,
|
|
70
|
-
...altButtonThemes,
|
|
71
|
-
[`${name}_Button`,
|
|
70
|
+
...altThemes.slice(0, alts.length),
|
|
71
|
+
...altButtonThemes.slice(0, alts.length),
|
|
72
|
+
[`${name}_Button`, altThemes2[1][1]],
|
|
73
|
+
[`${name}_DrawerFrame`, altThemes2[1][1]],
|
|
74
|
+
[`${name}_SliderTrack`, altThemes[0][1]],
|
|
75
|
+
[`${name}_SliderTrackActive`, altThemes[2][1]],
|
|
76
|
+
[`${name}_SliderThumb`, inverted[2]],
|
|
77
|
+
[`${name}_Progress`, altThemes[2][1]],
|
|
78
|
+
[`${name}_ProgressIndicator`, inverted[2]],
|
|
79
|
+
[`${name}_Switch`, altThemes[0][1]],
|
|
80
|
+
[`${name}_SwitchThumb`, inverted[2]],
|
|
81
|
+
[`${name}_TooltipArrow`, altThemes[1][1]],
|
|
82
|
+
[`${name}_TooltipContent`, altThemes[1][1]],
|
|
72
83
|
[`${name}_darker`, darkerTheme],
|
|
73
84
|
[`${name}_active`, activeTheme]
|
|
74
85
|
];
|
|
75
86
|
const themes2 = Object.fromEntries(themeEntries);
|
|
76
87
|
return themes2;
|
|
77
88
|
}
|
|
78
|
-
|
|
79
|
-
const createTheme = /* @__PURE__ */ __name((str = 1, {
|
|
89
|
+
const themeCreator = (str = 1, {
|
|
80
90
|
backgrounds,
|
|
81
91
|
isLight = true,
|
|
82
92
|
isBase = false,
|
|
83
93
|
colors = [...backgrounds].reverse(),
|
|
84
94
|
borderColors = isLight ? colors : backgrounds,
|
|
85
|
-
|
|
95
|
+
backgroundStrong,
|
|
86
96
|
offsets: offsetsProp
|
|
87
97
|
}) => {
|
|
88
98
|
const offsets = {
|
|
@@ -90,36 +100,49 @@ const createTheme = /* @__PURE__ */ __name((str = 1, {
|
|
|
90
100
|
background: (offsetsProp == null ? void 0 : offsetsProp.background) ?? [0, 0, 0, 0],
|
|
91
101
|
color: (offsetsProp == null ? void 0 : offsetsProp.color) ?? [0, 0, 0, 0]
|
|
92
102
|
};
|
|
93
|
-
const
|
|
103
|
+
const darkColors2 = isLight ? colors : backgrounds;
|
|
94
104
|
const lighterDir = isLight ? -1 : 1;
|
|
95
105
|
const darkerDir = -lighterDir;
|
|
96
106
|
const strongerDir = isLight ? darkerDir : lighterDir;
|
|
97
|
-
const
|
|
107
|
+
const softerDir = -strongerDir;
|
|
108
|
+
const get = (arr, index, name = "background") => {
|
|
98
109
|
return arr[Math.max(0, Math.min(index + (offsets[name][str] || 0), arr.length - 1))];
|
|
99
|
-
}
|
|
110
|
+
};
|
|
100
111
|
const colorTranslucent = (0, import_colorUtils.setColorAlpha)((0, import_core.getVariableValue)(get(colors, 0 + str, "color")), 0.5);
|
|
101
|
-
|
|
112
|
+
const theme = {
|
|
102
113
|
background: get(backgrounds, str),
|
|
103
|
-
|
|
104
|
-
backgroundSoft: get(backgrounds, str +
|
|
105
|
-
backgroundHover: get(backgrounds, str +
|
|
106
|
-
backgroundPress: get(backgrounds, str + darkerDir
|
|
114
|
+
backgroundStrong: backgroundStrong || get(backgrounds, str + strongerDir * 2),
|
|
115
|
+
backgroundSoft: get(backgrounds, str + softerDir * 2),
|
|
116
|
+
backgroundHover: get(backgrounds, str + lighterDir),
|
|
117
|
+
backgroundPress: get(backgrounds, str + darkerDir),
|
|
107
118
|
backgroundFocus: get(backgrounds, str + darkerDir * 2),
|
|
108
|
-
backgroundTransparent:
|
|
119
|
+
backgroundTransparent: "hsla(0, 0%, 0%, 0.012)",
|
|
109
120
|
color: get(colors, 0 + str, "color"),
|
|
110
121
|
colorHover: get(colors, 1 + str, "color"),
|
|
111
122
|
colorPress: get(colors, 2 + str, "color"),
|
|
112
123
|
colorFocus: get(colors, 3 + str, "color"),
|
|
113
124
|
colorTranslucent,
|
|
114
|
-
colorMid: colors[Math.floor(colors.length / 2)],
|
|
115
|
-
shadowColor: isLight ?
|
|
116
|
-
shadowColorHover:
|
|
117
|
-
shadowColorPress:
|
|
118
|
-
shadowColorFocus:
|
|
125
|
+
colorMid: (isLight ? colors : backgrounds)[Math.floor(colors.length / 2)],
|
|
126
|
+
shadowColor: isLight ? "hsla(0, 0%, 0%, 0.03)" : "hsla(0, 0%, 0%, 0.2)",
|
|
127
|
+
shadowColorHover: darkColors2[!isLight ? 1 : 8],
|
|
128
|
+
shadowColorPress: darkColors2[!isLight ? 1 : 8],
|
|
129
|
+
shadowColorFocus: darkColors2[!isLight ? 1 : 8],
|
|
119
130
|
borderColor: null,
|
|
120
131
|
borderColorHover: null,
|
|
121
132
|
borderColorPress: null,
|
|
122
|
-
borderColorFocus: null
|
|
133
|
+
borderColorFocus: null,
|
|
134
|
+
color1: backgrounds[0],
|
|
135
|
+
color2: backgrounds[1],
|
|
136
|
+
color3: backgrounds[2],
|
|
137
|
+
color4: backgrounds[3],
|
|
138
|
+
color5: backgrounds[4],
|
|
139
|
+
color6: backgrounds[5],
|
|
140
|
+
color7: backgrounds[6],
|
|
141
|
+
color8: backgrounds[7],
|
|
142
|
+
color9: backgrounds[8],
|
|
143
|
+
color10: backgrounds[9],
|
|
144
|
+
color11: backgrounds[10],
|
|
145
|
+
color12: backgrounds[11]
|
|
123
146
|
};
|
|
124
147
|
if (isBase) {
|
|
125
148
|
Object.assign(theme, {
|
|
@@ -137,62 +160,52 @@ const createTheme = /* @__PURE__ */ __name((str = 1, {
|
|
|
137
160
|
});
|
|
138
161
|
}
|
|
139
162
|
return theme;
|
|
140
|
-
}
|
|
141
|
-
const
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
]
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
"#
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
"#494949",
|
|
182
|
-
"#545454",
|
|
183
|
-
"#626262",
|
|
184
|
-
"#777777"
|
|
185
|
-
];
|
|
186
|
-
const lightThemes = createThemesFrom("light", createTheme, {
|
|
187
|
-
backgrounds: lightGradient,
|
|
188
|
-
backgroundStronger: "#fcfcfc",
|
|
189
|
-
borderColors: lightGradient.slice(2),
|
|
190
|
-
isLight: true
|
|
163
|
+
};
|
|
164
|
+
const themeColors = {
|
|
165
|
+
light: [
|
|
166
|
+
"#fff",
|
|
167
|
+
"#f4f4f4",
|
|
168
|
+
"hsl(0, 0%, 99.0%)",
|
|
169
|
+
"hsl(0, 0%, 97.3%)",
|
|
170
|
+
"hsl(0, 0%, 95.1%)",
|
|
171
|
+
"hsl(0, 0%, 93.0%)",
|
|
172
|
+
"hsl(0, 0%, 90.9%)",
|
|
173
|
+
"hsl(0, 0%, 88.7%)",
|
|
174
|
+
"hsl(0, 0%, 85.8%)",
|
|
175
|
+
"hsl(0, 0%, 78.0%)",
|
|
176
|
+
"hsl(0, 0%, 56.1%)",
|
|
177
|
+
"hsl(0, 0%, 52.3%)",
|
|
178
|
+
"hsl(0, 0%, 43.5%)",
|
|
179
|
+
"hsl(0, 0%, 9.0%)"
|
|
180
|
+
],
|
|
181
|
+
dark: [
|
|
182
|
+
"#111111",
|
|
183
|
+
"#151515",
|
|
184
|
+
"#191919",
|
|
185
|
+
"#232323",
|
|
186
|
+
"#282828",
|
|
187
|
+
"#323232",
|
|
188
|
+
"#383838",
|
|
189
|
+
"#424242",
|
|
190
|
+
"#494949",
|
|
191
|
+
"#545454",
|
|
192
|
+
"#626262",
|
|
193
|
+
"#777777"
|
|
194
|
+
]
|
|
195
|
+
};
|
|
196
|
+
const lightThemes = createThemesFrom("light", themeCreator, {
|
|
197
|
+
backgrounds: themeColors.light,
|
|
198
|
+
backgroundStrong: import_core.isWeb ? "#fefefe" : "#f2f2f2",
|
|
199
|
+
borderColors: themeColors.light.slice(2),
|
|
200
|
+
isLight: true,
|
|
201
|
+
offsets: {
|
|
202
|
+
background: [2, 2, 2, 2, 2, 2]
|
|
203
|
+
}
|
|
191
204
|
});
|
|
192
|
-
const darkThemes = createThemesFrom("dark",
|
|
193
|
-
backgrounds:
|
|
194
|
-
colors:
|
|
195
|
-
|
|
205
|
+
const darkThemes = createThemesFrom("dark", themeCreator, {
|
|
206
|
+
backgrounds: themeColors.dark,
|
|
207
|
+
colors: themeColors.light.slice(2),
|
|
208
|
+
backgroundStrong: "#070707",
|
|
196
209
|
isBase: true,
|
|
197
210
|
isLight: false,
|
|
198
211
|
shift: 1,
|
|
@@ -200,45 +213,78 @@ const darkThemes = createThemesFrom("dark", createTheme, {
|
|
|
200
213
|
color: [0, 4, 5, 5, 5, 5]
|
|
201
214
|
}
|
|
202
215
|
});
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
216
|
+
darkThemes.dark_darker.background = "#030303";
|
|
217
|
+
darkThemes.dark_darker.backgroundStrong = "#000";
|
|
218
|
+
const light = (0, import_core.createTheme)({
|
|
219
|
+
...import_tokens.lightColors,
|
|
220
|
+
...lightThemes.light
|
|
221
|
+
});
|
|
222
|
+
const dark = (0, import_core.createTheme)({
|
|
223
|
+
...import_tokens.darkColors,
|
|
224
|
+
...darkThemes.dark
|
|
225
|
+
});
|
|
226
|
+
const baseThemes = {
|
|
227
|
+
...lightThemes,
|
|
228
|
+
light,
|
|
229
|
+
light_active: lightThemes.light,
|
|
206
230
|
light_Card: lightThemes.light,
|
|
231
|
+
light_SliderTrack: lightThemes.light_alt1,
|
|
232
|
+
light_SliderTrackActive: lightThemes.light_alt2,
|
|
233
|
+
light_Switch: lightThemes.light_alt2,
|
|
234
|
+
light_SwitchThumb: lightThemes.light,
|
|
207
235
|
light_DrawerFrame: lightThemes.light_alt1,
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
236
|
+
...darkThemes,
|
|
237
|
+
dark,
|
|
238
|
+
dark_active: darkThemes.dark,
|
|
239
|
+
dark_Card: darkThemes.dark,
|
|
240
|
+
dark_DrawerFrame: darkThemes.dark_alt1,
|
|
241
|
+
dark_SliderTrack: darkThemes.dark_darker,
|
|
242
|
+
dark_SliderTrackActive: darkThemes.dark_alt2,
|
|
243
|
+
dark_Switch: darkThemes.dark_alt2,
|
|
244
|
+
dark_SwitchThumb: darkThemes.dark_darker,
|
|
214
245
|
dark_Button: darkThemes.dark_alt1
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
return res;
|
|
246
|
+
};
|
|
247
|
+
const darkEntries = Object.entries(dark);
|
|
248
|
+
const lightEntries = Object.entries(light);
|
|
249
|
+
function findColors(prefix, dark2 = false) {
|
|
250
|
+
return Object.fromEntries(
|
|
251
|
+
(dark2 ? darkEntries : lightEntries).filter(([k]) => k.startsWith(prefix))
|
|
252
|
+
);
|
|
223
253
|
}
|
|
224
|
-
|
|
225
|
-
|
|
254
|
+
const colorSchemes = [
|
|
255
|
+
{ name: "blue", colors: findColors("blue"), darkColors: findColors("blue", true) },
|
|
256
|
+
{ name: "gray", colors: findColors("gray"), darkColors: findColors("gray", true) },
|
|
257
|
+
{ name: "green", colors: findColors("green"), darkColors: findColors("green", true) },
|
|
258
|
+
{ name: "orange", colors: findColors("orange"), darkColors: findColors("orange", true) },
|
|
259
|
+
{ name: "pink", colors: findColors("pink"), darkColors: findColors("pink", true) },
|
|
260
|
+
{ name: "purple", colors: findColors("purple"), darkColors: findColors("purple", true) },
|
|
261
|
+
{ name: "red", colors: findColors("red"), darkColors: findColors("red", true) },
|
|
262
|
+
{ name: "yellow", colors: findColors("yellow"), darkColors: findColors("yellow", true) }
|
|
263
|
+
];
|
|
264
|
+
const colorNames = [
|
|
265
|
+
"blue",
|
|
266
|
+
"green",
|
|
267
|
+
"orange",
|
|
268
|
+
"pink",
|
|
269
|
+
"purple",
|
|
270
|
+
"red",
|
|
271
|
+
"yellow",
|
|
272
|
+
"gray"
|
|
273
|
+
];
|
|
274
|
+
const colorThemeEntries = colorSchemes.flatMap(({ name, colors, darkColors: darkColors2 }) => {
|
|
226
275
|
const [altLightThemes, altDarkThemes] = [
|
|
227
|
-
{ colors:
|
|
228
|
-
{ colors, backgrounds:
|
|
276
|
+
{ colors: darkColors2, backgrounds: colors },
|
|
277
|
+
{ colors, backgrounds: darkColors2 }
|
|
229
278
|
].map((props, i) => {
|
|
230
279
|
const isLight = i === 0;
|
|
280
|
+
const colorsBase = Object.values(props.colors).slice(2);
|
|
231
281
|
const [backgrounds, colors2] = [
|
|
232
282
|
Object.values(props.backgrounds),
|
|
233
|
-
|
|
283
|
+
isLight ? colorsBase : [colorsBase[0], "#ccc", ...colorsBase.slice(1)]
|
|
234
284
|
];
|
|
235
285
|
const scheme = isLight ? "light" : "dark";
|
|
236
286
|
const shift = isLight ? 0 : 1;
|
|
237
|
-
|
|
238
|
-
const [_, h, sp, lp] = backgrounds[0].match(/hsl\(([0-9\.]+), ([0-9\.]+)\%, ([0-9\.]+)\%\)/);
|
|
239
|
-
backgrounds.unshift(`hsl(${h}, ${sp}%, ${parseFloat(lp) / 2}%)`);
|
|
240
|
-
}
|
|
241
|
-
const themeWithAlts = createThemesFrom(name, createTheme, {
|
|
287
|
+
const themeWithAlts = createThemesFrom(name, themeCreator, {
|
|
242
288
|
colors: colors2,
|
|
243
289
|
backgrounds,
|
|
244
290
|
borderColors: backgrounds,
|
|
@@ -246,34 +292,37 @@ const colorThemeEntries = colorSchemes.flatMap(({ name, colors, darkColors }) =>
|
|
|
246
292
|
shift,
|
|
247
293
|
isBase: false,
|
|
248
294
|
offsets: {
|
|
249
|
-
background: isLight ? [
|
|
295
|
+
background: isLight ? [2, 2, 2, 2, 2, 2] : null,
|
|
250
296
|
borderColor: isLight ? [2, 2, 2, 3, 2] : null,
|
|
251
297
|
color: isLight ? [0, 0, -1, -2, -3, -3, -4] : [-1, -1, -1, -1, -1, -1]
|
|
252
298
|
}
|
|
253
299
|
});
|
|
254
300
|
return Object.entries(themeWithAlts).map(([k, v]) => [`${scheme}_${k}`, v]);
|
|
255
301
|
});
|
|
256
|
-
|
|
257
|
-
const darkButtonTheme = altDarkThemes[0];
|
|
258
|
-
return [
|
|
259
|
-
...altLightThemes,
|
|
260
|
-
[`${lightButtonTheme[0]}_Button`, altLightThemes[2][1]],
|
|
261
|
-
[`${lightButtonTheme[0]}_Card`, altLightThemes[2][1]],
|
|
262
|
-
[`${lightButtonTheme[0]}_DrawerFrame`, altLightThemes[2][1]],
|
|
263
|
-
...altDarkThemes,
|
|
264
|
-
[`${darkButtonTheme[0]}_Button`, altDarkThemes[2][1]],
|
|
265
|
-
[`${darkButtonTheme[0]}_Card`, altDarkThemes[2][1]],
|
|
266
|
-
[`${darkButtonTheme[0]}_DrawerFrame`, altDarkThemes[2][1]]
|
|
267
|
-
];
|
|
302
|
+
return [...altLightThemes, ...altDarkThemes];
|
|
268
303
|
});
|
|
269
304
|
const colorThemes = Object.fromEntries(colorThemeEntries);
|
|
270
|
-
|
|
305
|
+
baseThemes.dark_active = {
|
|
306
|
+
...colorThemes.dark_blue_alt2,
|
|
307
|
+
background: import_tokens.darkColors.blue10,
|
|
308
|
+
backgroundHover: import_tokens.darkColors.blue11,
|
|
309
|
+
backgroundPress: import_tokens.darkColors.blue9,
|
|
310
|
+
backgroundFocus: import_tokens.darkColors.blue9,
|
|
311
|
+
color: import_tokens.darkColors.blue12,
|
|
312
|
+
colorHover: import_tokens.darkColors.blue12,
|
|
313
|
+
colorPress: import_tokens.darkColors.blue12,
|
|
314
|
+
colorFocus: import_tokens.darkColors.blue12
|
|
315
|
+
};
|
|
316
|
+
baseThemes.light_active = baseThemes.dark_active;
|
|
317
|
+
const allThemes = {
|
|
318
|
+
...baseThemes,
|
|
319
|
+
...colorThemes
|
|
320
|
+
};
|
|
271
321
|
const themes = allThemes;
|
|
272
322
|
// Annotate the CommonJS export names for ESM import in node:
|
|
273
323
|
0 && (module.exports = {
|
|
324
|
+
colorNames,
|
|
274
325
|
colorSchemes,
|
|
275
|
-
darkGradient,
|
|
276
|
-
lightGradient,
|
|
277
326
|
themes
|
|
278
327
|
});
|
|
279
328
|
//# sourceMappingURL=themes.js.map
|