云
2026-09-15 1c829f9177eab675b22be4d20ef2761ed1bbb423
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
66
67
68
69
70
71
// 暗色大屏 ECharts 主题常量:CSS 变量无法用于 JS 配置,统一在此收口
// 色值为 tokens.scss 语义色在深底上的提亮版,与 dashboard-dark.scss 保持对应
 
const toRgb = (hex) => [1, 3, 5].map((i) => parseInt(hex.slice(i, i + 2), 16))
 
export const BI_COLORS = {
  primary: '#5b8cff',
  green: '#2dbd85',
  amber: '#f5a524',
  red: '#f2635b',
  violet: '#8b7cf8',
  teal: '#2bc8c8',
  text: '#9fb0cf',
  textStrong: '#e8eefc',
  surface: '#111c33',
  axisLine: 'rgba(159, 176, 207, 0.25)',
  splitLine: 'rgba(159, 176, 207, 0.12)',
}
 
// 首页 PIE_COLORS 的暗底提亮版
export const BI_PIE_PALETTE = [
  BI_COLORS.primary,
  BI_COLORS.green,
  BI_COLORS.amber,
  BI_COLORS.red,
  BI_COLORS.violet,
  BI_COLORS.teal,
  '#ff8a3d',
  '#4a6cf0',
  '#b37feb',
  '#1377ef',
]
 
export const BI_TOOLTIP = {
  backgroundColor: '#16233d',
  borderColor: '#1f2f4d',
  borderWidth: 1,
  textStyle: { color: BI_COLORS.textStrong, fontSize: 12 },
}
 
// 柱顶实色、柱底渐隐,替代原青色荧光渐变
export const barGradient = (hex) => {
  const rgb = toRgb(hex).join(',')
  return {
    type: 'linear',
    x: 0,
    y: 0,
    x2: 0,
    y2: 1,
    colorStops: [
      { offset: 0, color: `rgba(${rgb}, 0.9)` },
      { offset: 1, color: `rgba(${rgb}, 0.05)` },
    ],
  }
}
 
// 折线面积渐变,配方对齐首页 HomeInvoiceChart(0.22 → 0.02)
export const areaGradient = (hex) => {
  const rgb = toRgb(hex).join(',')
  return {
    type: 'linear',
    x: 0,
    y: 0,
    x2: 0,
    y2: 1,
    colorStops: [
      { offset: 0, color: `rgba(${rgb}, 0.22)` },
      { offset: 1, color: `rgba(${rgb}, 0.02)` },
    ],
  }
}