-
Notifications
You must be signed in to change notification settings - Fork 138
/
getExtendedColorTokens.ts
65 lines (52 loc) · 2.01 KB
/
getExtendedColorTokens.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/**
* @license
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://github.com/IDuxFE/idux/blob/main/LICENSE
*/
import type { BasicTokens, DerivedTokens, ExtendedColorTokens, GetColorPalette, GetGreyColors } from '../../../types'
export function getExtendedColorTokens(
tokens: BasicTokens & DerivedTokens,
getColorPalette: GetColorPalette,
getGreyColors: GetGreyColors,
): ExtendedColorTokens {
const greyColors = getGreyColors()
const { colorPrimary, colorWarning, colorError, colorBg } = tokens
const primaryColorPalette = getColorPalette(colorPrimary)
return {
colorContainerBg: colorBg, // 一级背景
colorContainerBgHover: greyColors.l50,
colorContainerBgActive: primaryColorPalette.l50,
colorContainerBgDisabled: greyColors.l40,
colorAddonContainerBg: greyColors.l50,
colorEmphasizedContainerBg: greyColors.l40,
colorEmphasizedContainerBgHover: greyColors.l30,
colorEmphasizedContainerBgDisabled: greyColors.l10,
colorInfoContainerBg: greyColors.l50,
colorInfoContainerBgHover: greyColors.l50,
colorInfoContainerBgDisabled: greyColors.l30,
colorFillContainerBg: greyColors.l10,
colorSeparator: greyColors.l30,
colorTextPlaceholder: greyColors.base,
colorTextDisabled: greyColors.l10,
colorTextInverse: colorBg,
colorTextInverseDisabled: greyColors.l10,
colorTextTitle: greyColors.d40,
colorTextTitleSecondary: greyColors.d30,
colorTextInfo: greyColors.d10,
colorIcon: greyColors.d20,
colorIconInfo: greyColors.l10,
colorIconHover: colorPrimary,
colorIconActive: primaryColorPalette.d10,
colorIconDisabled: greyColors.l10,
colorWarningOutline: colorWarning,
colorErrorOutline: colorError,
colorBgInverse: greyColors.d40,
colorBgInverseDisabled: greyColors.d50,
colorBorderInverse: colorBg,
colorBorderSecondary: greyColors.l30,
colorMask: 'rgba(0, 0, 0, 0.45)',
tagCompColorAlpha: 0.1,
alertCompColorAlpha: 0.1,
}
}