@blocklet/pages-kit 0.7.20 → 0.7.22
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/lib/cjs/contexts/color.js +17 -10
- package/lib/cjs/tsconfig.tsbuildinfo +1 -1
- package/lib/cjs/utils/common.js +1 -1
- package/lib/esm/contexts/color.js +17 -10
- package/lib/esm/tsconfig.tsbuildinfo +1 -1
- package/lib/esm/utils/common.js +1 -1
- package/lib/types/contexts/color.d.ts +3 -4
- package/lib/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
|
@@ -11,6 +11,7 @@ const styles_1 = require("@mui/material/styles");
|
|
|
11
11
|
const get_1 = __importDefault(require("lodash/get"));
|
|
12
12
|
const react_1 = require("react");
|
|
13
13
|
const style_1 = require("../utils/style");
|
|
14
|
+
const grey25 = { light: '#F8FAFC', dark: 'rgba(255, 255, 255, 0.05)' }; // 扩展 grey25 颜色
|
|
14
15
|
/**
|
|
15
16
|
* Hook 用于获取和操作 MUI 主题色
|
|
16
17
|
*/
|
|
@@ -31,7 +32,7 @@ function useMuiColorPalette() {
|
|
|
31
32
|
// 特殊颜色组
|
|
32
33
|
{
|
|
33
34
|
type: 'special',
|
|
34
|
-
keys: ['transparent', 'auto'],
|
|
35
|
+
keys: ['transparent', 'auto', 'grey25'],
|
|
35
36
|
variants: null,
|
|
36
37
|
format: (key) => key,
|
|
37
38
|
accessor: (key) => ({ [key]: key }),
|
|
@@ -120,7 +121,15 @@ function useMuiColorPalette() {
|
|
|
120
121
|
const alternateColorValue = (0, get_1.default)(alternateTheme, `palette.${colorKey}`, '');
|
|
121
122
|
if (paletteObj && typeof paletteObj === 'object') {
|
|
122
123
|
const colorValue = String(paletteObj[variant ?? key] || '');
|
|
123
|
-
if (
|
|
124
|
+
if (key === 'grey25') {
|
|
125
|
+
colors.push({
|
|
126
|
+
colorKey,
|
|
127
|
+
colorValue: grey25[theme.palette.mode],
|
|
128
|
+
group: config.type,
|
|
129
|
+
alternateColorValue: grey25[alternateTheme.palette.mode],
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
else if (colorValue) {
|
|
124
133
|
colors.push({ colorKey, colorValue, group: config.type, alternateColorValue });
|
|
125
134
|
}
|
|
126
135
|
}
|
|
@@ -193,20 +202,18 @@ function useColorConvert() {
|
|
|
193
202
|
}, [theme, style_1.colorConvert]);
|
|
194
203
|
}
|
|
195
204
|
function useBackgroundColorStyle() {
|
|
196
|
-
const
|
|
197
|
-
if (color === 'auto') {
|
|
198
|
-
return (0, style_1.gradientFromPrimary)();
|
|
199
|
-
}
|
|
200
|
-
return color;
|
|
201
|
-
}, []);
|
|
205
|
+
const theme = (0, styles_1.useTheme)();
|
|
202
206
|
const getBackgroundColorStyle = (0, react_1.useCallback)((color = '') => {
|
|
203
207
|
if (color === 'auto') {
|
|
204
208
|
return { backgroundImage: (0, style_1.gradientFromPrimary)() };
|
|
205
209
|
}
|
|
210
|
+
if (color === 'grey25') {
|
|
211
|
+
return { bgcolor: grey25[theme.palette.mode] };
|
|
212
|
+
}
|
|
206
213
|
if ((0, style_1.isGradient)(color)) {
|
|
207
214
|
return { backgroundImage: color };
|
|
208
215
|
}
|
|
209
216
|
return { bgcolor: color };
|
|
210
|
-
}, []);
|
|
211
|
-
return { getBackgroundColorStyle
|
|
217
|
+
}, [theme]);
|
|
218
|
+
return { getBackgroundColorStyle };
|
|
212
219
|
}
|