@363045841yyt/klinechart-core 0.7.3 → 0.7.5
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/README.md +201 -201
- package/README.zh-CN.md +201 -201
- package/dist/controllers/index.d.ts +1 -0
- package/dist/controllers/index.d.ts.map +1 -1
- package/dist/controllers/index.js +1 -0
- package/dist/controllers/index.js.map +1 -1
- package/dist/engine/chart.d.ts +11 -19
- package/dist/engine/chart.d.ts.map +1 -1
- package/dist/engine/chart.js +92 -109
- package/dist/engine/chart.js.map +1 -1
- package/dist/engine/renderers/Indicator/indicatorData.d.ts +1 -0
- package/dist/engine/renderers/Indicator/indicatorData.d.ts.map +1 -1
- package/dist/engine/renderers/Indicator/indicatorData.js +1 -1
- package/dist/engine/renderers/Indicator/indicatorData.js.map +1 -1
- package/dist/engine/renderers/webgl/candleSurface.js +47 -47
- package/dist/engine/subPaneManager.d.ts +4 -0
- package/dist/engine/subPaneManager.d.ts.map +1 -1
- package/dist/engine/subPaneManager.js +13 -0
- package/dist/engine/subPaneManager.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +1 -2
- package/dist/version.js.map +1 -1
- package/package.json +129 -122
- package/src/__tests__/signal.test.ts +124 -124
- package/src/config/chartSettings.ts +66 -66
- package/src/controllers/__tests__/drawing.test.ts +214 -214
- package/src/controllers/__tests__/indicatorSelector.test.ts +481 -481
- package/src/controllers/__tests__/toolbar.test.ts +225 -225
- package/src/controllers/createChartController.ts +665 -665
- package/src/controllers/createDrawingController.ts +96 -96
- package/src/controllers/createIndicatorSelectorController.ts +307 -307
- package/src/controllers/createToolbarController.ts +146 -146
- package/src/controllers/index.ts +20 -19
- package/src/controllers/types.ts +284 -284
- package/src/engine/__tests__/chart.dpr.test.ts +401 -401
- package/src/engine/__tests__/paneRenderer.resize.test.ts +92 -92
- package/src/engine/chart-store.ts +121 -121
- package/src/engine/chart.d.ts +617 -617
- package/src/engine/chart.ts +2803 -2815
- package/src/engine/controller/__tests__/interaction.dpr.test.ts +259 -259
- package/src/engine/controller/interaction.ts +722 -722
- package/src/engine/controller/markerInteraction.ts +130 -130
- package/src/engine/controller/pinchTracker.ts +82 -82
- package/src/engine/controller/tooltipPosition.ts +48 -48
- package/src/engine/draw/__tests__/pixelAlign.spec.ts +176 -176
- package/src/engine/draw/pixelAlign.ts +259 -259
- package/src/engine/drawing/index.ts +655 -655
- package/src/engine/drawing/interaction.ts +842 -842
- package/src/engine/drawing/plugin.ts +343 -343
- package/src/engine/indicators/__tests__/__fixtures__/golden/atr.json +38 -38
- package/src/engine/indicators/__tests__/__fixtures__/golden/dema.json +14 -14
- package/src/engine/indicators/__tests__/__fixtures__/golden/hma.json +14 -14
- package/src/engine/indicators/__tests__/__fixtures__/golden/index.ts +55 -55
- package/src/engine/indicators/__tests__/__fixtures__/golden/kama.json +14 -14
- package/src/engine/indicators/__tests__/__fixtures__/golden/tema.json +14 -14
- package/src/engine/indicators/__tests__/__fixtures__/golden/wma.json +40 -40
- package/src/engine/indicators/__tests__/__fixtures__/synthetic.ts +65 -65
- package/src/engine/indicators/__tests__/_propertyAssertions.ts +76 -76
- package/src/engine/indicators/__tests__/atr.test.ts +153 -153
- package/src/engine/indicators/__tests__/calculators.test.ts +614 -614
- package/src/engine/indicators/__tests__/cmf-mfi.test.ts +100 -100
- package/src/engine/indicators/__tests__/dema.test.ts +73 -73
- package/src/engine/indicators/__tests__/donchian.test.ts +70 -70
- package/src/engine/indicators/__tests__/hma.test.ts +73 -73
- package/src/engine/indicators/__tests__/ichimoku.test.ts +105 -105
- package/src/engine/indicators/__tests__/kama.test.ts +80 -80
- package/src/engine/indicators/__tests__/keltner.test.ts +65 -65
- package/src/engine/indicators/__tests__/pivot-fib.test.ts +110 -110
- package/src/engine/indicators/__tests__/roc.test.ts +68 -68
- package/src/engine/indicators/__tests__/sar.test.ts +86 -86
- package/src/engine/indicators/__tests__/scheduler.test.ts +831 -831
- package/src/engine/indicators/__tests__/soa.test.ts +533 -533
- package/src/engine/indicators/__tests__/structure.test.ts +110 -110
- package/src/engine/indicators/__tests__/supertrend.test.ts +65 -65
- package/src/engine/indicators/__tests__/tema.test.ts +68 -68
- package/src/engine/indicators/__tests__/trix.test.ts +70 -70
- package/src/engine/indicators/__tests__/volatility.test.ts +117 -117
- package/src/engine/indicators/__tests__/volume.test.ts +115 -115
- package/src/engine/indicators/__tests__/volumeProfile.test.ts +74 -74
- package/src/engine/indicators/__tests__/vwap.test.ts +69 -69
- package/src/engine/indicators/__tests__/wma.test.ts +112 -112
- package/src/engine/indicators/__tests__/zones.test.ts +95 -95
- package/src/engine/indicators/atrState.ts +27 -27
- package/src/engine/indicators/bollState.ts +51 -51
- package/src/engine/indicators/calculators.ts +2593 -2593
- package/src/engine/indicators/cciState.ts +25 -25
- package/src/engine/indicators/chaikinVolState.ts +32 -32
- package/src/engine/indicators/cmfState.ts +27 -27
- package/src/engine/indicators/demaState.ts +27 -27
- package/src/engine/indicators/donchianState.ts +43 -43
- package/src/engine/indicators/eneState.ts +43 -43
- package/src/engine/indicators/expmaState.ts +43 -43
- package/src/engine/indicators/fastkState.ts +25 -25
- package/src/engine/indicators/fibState.ts +41 -41
- package/src/engine/indicators/hmaState.ts +27 -27
- package/src/engine/indicators/hvState.ts +28 -28
- package/src/engine/indicators/ichimokuState.ts +70 -70
- package/src/engine/indicators/indicator.worker.ts +169 -169
- package/src/engine/indicators/indicatorDefinitionRegistry.ts +62 -62
- package/src/engine/indicators/indicatorMetadata.ts +110 -110
- package/src/engine/indicators/indicatorRegistry.ts +106 -106
- package/src/engine/indicators/indicatorRuntime.ts +1548 -1548
- package/src/engine/indicators/kamaState.ts +34 -34
- package/src/engine/indicators/keltnerState.ts +49 -49
- package/src/engine/indicators/kstState.ts +42 -42
- package/src/engine/indicators/maState.ts +36 -36
- package/src/engine/indicators/macdState.ts +76 -76
- package/src/engine/indicators/mfiState.ts +27 -27
- package/src/engine/indicators/momState.ts +25 -25
- package/src/engine/indicators/obvState.ts +25 -25
- package/src/engine/indicators/parkinsonState.ts +28 -28
- package/src/engine/indicators/pivotState.ts +51 -51
- package/src/engine/indicators/pvtState.ts +25 -25
- package/src/engine/indicators/rocState.ts +27 -27
- package/src/engine/indicators/rsiState.ts +65 -65
- package/src/engine/indicators/sarState.ts +41 -41
- package/src/engine/indicators/scheduler.ts +1205 -1205
- package/src/engine/indicators/soa.ts +352 -352
- package/src/engine/indicators/stateComposer.ts +1262 -1262
- package/src/engine/indicators/stochState.ts +26 -26
- package/src/engine/indicators/structureState.ts +69 -69
- package/src/engine/indicators/supertrendState.ts +37 -37
- package/src/engine/indicators/temaState.ts +27 -27
- package/src/engine/indicators/trixState.ts +35 -35
- package/src/engine/indicators/vmaState.ts +27 -27
- package/src/engine/indicators/volumeProfileState.ts +63 -63
- package/src/engine/indicators/vwapState.ts +29 -29
- package/src/engine/indicators/wmaState.ts +27 -27
- package/src/engine/indicators/wmsrState.ts +25 -25
- package/src/engine/indicators/workerProtocol.ts +613 -613
- package/src/engine/indicators/zonesState.ts +47 -47
- package/src/engine/layout/pane.ts +161 -161
- package/src/engine/marker/registry.ts +265 -265
- package/src/engine/paneRenderer.ts +169 -169
- package/src/engine/renderers/Indicator/atr.ts +237 -237
- package/src/engine/renderers/Indicator/boll.ts +317 -317
- package/src/engine/renderers/Indicator/cci.ts +275 -275
- package/src/engine/renderers/Indicator/chaikinVol.ts +138 -138
- package/src/engine/renderers/Indicator/cmf.ts +137 -137
- package/src/engine/renderers/Indicator/dema.ts +136 -136
- package/src/engine/renderers/Indicator/donchian.ts +137 -137
- package/src/engine/renderers/Indicator/ene.ts +271 -271
- package/src/engine/renderers/Indicator/expma.ts +197 -197
- package/src/engine/renderers/Indicator/fastk.ts +316 -316
- package/src/engine/renderers/Indicator/fib.ts +141 -141
- package/src/engine/renderers/Indicator/hma.ts +136 -136
- package/src/engine/renderers/Indicator/hv.ts +124 -124
- package/src/engine/renderers/Indicator/ichimoku.ts +181 -181
- package/src/engine/renderers/Indicator/index.ts +241 -241
- package/src/engine/renderers/Indicator/indicatorData.ts +650 -650
- package/src/engine/renderers/Indicator/kama.ts +136 -136
- package/src/engine/renderers/Indicator/keltner.ts +137 -137
- package/src/engine/renderers/Indicator/kst.ts +302 -302
- package/src/engine/renderers/Indicator/ma.ts +200 -200
- package/src/engine/renderers/Indicator/macd.ts +477 -477
- package/src/engine/renderers/Indicator/macdLegend.ts +141 -141
- package/src/engine/renderers/Indicator/mainIndicatorLegend.ts +272 -272
- package/src/engine/renderers/Indicator/mfi.ts +142 -142
- package/src/engine/renderers/Indicator/mom.ts +311 -311
- package/src/engine/renderers/Indicator/obv.ts +123 -123
- package/src/engine/renderers/Indicator/parkinson.ts +124 -124
- package/src/engine/renderers/Indicator/pivot.ts +131 -131
- package/src/engine/renderers/Indicator/pvt.ts +123 -123
- package/src/engine/renderers/Indicator/roc.ts +143 -143
- package/src/engine/renderers/Indicator/rsi.ts +390 -390
- package/src/engine/renderers/Indicator/sar.ts +113 -113
- package/src/engine/renderers/Indicator/scale/atr_scale.ts +19 -19
- package/src/engine/renderers/Indicator/scale/cci_scale.ts +19 -19
- package/src/engine/renderers/Indicator/scale/fastk_scale.ts +19 -19
- package/src/engine/renderers/Indicator/scale/indicator_scale.ts +204 -204
- package/src/engine/renderers/Indicator/scale/kst_scale.ts +19 -19
- package/src/engine/renderers/Indicator/scale/macd_scale.ts +22 -22
- package/src/engine/renderers/Indicator/scale/mom_scale.ts +19 -19
- package/src/engine/renderers/Indicator/scale/rsi_scale.ts +19 -19
- package/src/engine/renderers/Indicator/scale/stoch_scale.ts +19 -19
- package/src/engine/renderers/Indicator/scale/volume_scale.ts +26 -26
- package/src/engine/renderers/Indicator/scale/wmsr_scale.ts +19 -19
- package/src/engine/renderers/Indicator/stoch.ts +359 -359
- package/src/engine/renderers/Indicator/structure.ts +126 -126
- package/src/engine/renderers/Indicator/subPaneConfig.ts +265 -265
- package/src/engine/renderers/Indicator/supertrend.ts +115 -115
- package/src/engine/renderers/Indicator/tema.ts +136 -136
- package/src/engine/renderers/Indicator/trix.ts +158 -158
- package/src/engine/renderers/Indicator/vma.ts +124 -124
- package/src/engine/renderers/Indicator/volumeProfile.ts +125 -125
- package/src/engine/renderers/Indicator/vwap.ts +123 -123
- package/src/engine/renderers/Indicator/wma.ts +136 -136
- package/src/engine/renderers/Indicator/wmsr.ts +328 -328
- package/src/engine/renderers/Indicator/zones.ts +104 -104
- package/src/engine/renderers/__tests__/boll.renderer.test.ts +314 -314
- package/src/engine/renderers/__tests__/ene.renderer.test.ts +305 -305
- package/src/engine/renderers/__tests__/expma.renderer.test.ts +279 -279
- package/src/engine/renderers/__tests__/ma.renderer.test.ts +426 -426
- package/src/engine/renderers/__tests__/mainIndicatorLegend.renderer.test.ts +502 -502
- package/src/engine/renderers/__tests__/yAxis.renderer.test.ts +173 -173
- package/src/engine/renderers/candle.ts +459 -459
- package/src/engine/renderers/crosshair.ts +69 -69
- package/src/engine/renderers/customMarkers.ts +162 -162
- package/src/engine/renderers/extremaMarkers.ts +246 -246
- package/src/engine/renderers/gridLines.ts +90 -90
- package/src/engine/renderers/lastPrice.ts +97 -97
- package/src/engine/renderers/paneTitle.ts +136 -136
- package/src/engine/renderers/subVolume.ts +236 -236
- package/src/engine/renderers/timeAxis.ts +121 -121
- package/src/engine/renderers/webgl/candleSurface.ts +955 -955
- package/src/engine/renderers/webgl/sharedWebGLSurface.ts +146 -146
- package/src/engine/renderers/yAxis.ts +105 -105
- package/src/engine/scale/__tests__/logFormula.spec.ts +148 -148
- package/src/engine/scale/logFormula.ts +130 -130
- package/src/engine/scale/price.ts +39 -39
- package/src/engine/scale/priceScale.ts +264 -264
- package/src/engine/subPaneManager.ts +442 -427
- package/src/engine/theme/colors.ts +642 -642
- package/src/engine/theme/fonts.ts +20 -20
- package/src/engine/utils/klineConfig.ts +49 -49
- package/src/engine/utils/tickCount.ts +11 -11
- package/src/engine/utils/tickPosition.ts +214 -214
- package/src/engine/utils/zoom.ts +83 -83
- package/src/engine/viewport/viewport.ts +67 -67
- package/src/index.ts +3 -3
- package/src/plugin/ConfigManager.ts +93 -93
- package/src/plugin/EventBus.ts +77 -77
- package/src/plugin/HookSystem.ts +106 -106
- package/src/plugin/PluginHost.ts +243 -243
- package/src/plugin/PluginRegistry.ts +92 -92
- package/src/plugin/StateStore.ts +73 -73
- package/src/plugin/index.ts +19 -19
- package/src/plugin/rendererPluginManager.ts +368 -368
- package/src/plugin/stateKeys.ts +8 -8
- package/src/plugin/types.ts +526 -526
- package/src/reactivity/index.ts +2 -2
- package/src/reactivity/signal.ts +119 -119
- package/src/semantic/controller.ts +251 -251
- package/src/semantic/drawShape.ts +260 -260
- package/src/semantic/index.ts +28 -28
- package/src/semantic/schema.json +256 -256
- package/src/semantic/types.ts +251 -251
- package/src/semantic/validator.ts +349 -349
- package/src/types/kLine.ts +13 -13
- package/src/types/price.ts +56 -56
- package/src/types/volumePrice.ts +33 -33
- package/src/utils/dateFormat.ts +208 -208
- package/src/utils/kLineDraw/axis.ts +562 -562
- package/src/utils/priceToY.ts +34 -34
- package/src/utils/volumePrice.ts +202 -202
- package/src/version.ts +1 -1
|
@@ -1,642 +1,642 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 主题感知颜色配置
|
|
3
|
-
* 所有颜色通过 getColors(theme) 获取,支持 light/dark 双主题
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
/** 主题类型 */
|
|
7
|
-
export type ChartTheme = 'light' | 'dark'
|
|
8
|
-
|
|
9
|
-
/** 文本颜色 */
|
|
10
|
-
export interface TextColors {
|
|
11
|
-
PRIMARY: string
|
|
12
|
-
SECONDARY: string
|
|
13
|
-
TERTIARY: string
|
|
14
|
-
WEAK: string
|
|
15
|
-
WHITE: string
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
/** 涨跌价格颜色 */
|
|
19
|
-
export interface PriceColors {
|
|
20
|
-
UP: string
|
|
21
|
-
UP_LIGHT: string
|
|
22
|
-
UP_TICK: string
|
|
23
|
-
DOWN: string
|
|
24
|
-
DOWN_LIGHT: string
|
|
25
|
-
DOWN_TICK: string
|
|
26
|
-
NEUTRAL: string
|
|
27
|
-
LAST_PRICE: string
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/** 标签背景颜色 */
|
|
31
|
-
export interface TagBgColors {
|
|
32
|
-
WHITE: string
|
|
33
|
-
LIGHT_GRAY: string
|
|
34
|
-
PURE_WHITE: string
|
|
35
|
-
TRANSPARENT: string
|
|
36
|
-
ACTIVE: string
|
|
37
|
-
ACTIVE_HOVER: string
|
|
38
|
-
HOVER: string
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/** 边框颜色 */
|
|
42
|
-
export interface BorderColors {
|
|
43
|
-
DARK: string
|
|
44
|
-
MEDIUM: string
|
|
45
|
-
LIGHT: string
|
|
46
|
-
SEPARATOR: string
|
|
47
|
-
BUTTON: string
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/** 网格线颜色 */
|
|
51
|
-
export interface GridColors {
|
|
52
|
-
HORIZONTAL: string
|
|
53
|
-
VERTICAL: string
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
/** 十字线颜色 */
|
|
57
|
-
export interface CrosshairColors {
|
|
58
|
-
LINE: string
|
|
59
|
-
LABEL_BG: string
|
|
60
|
-
LABEL_TEXT: string
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
/** 均线颜色 */
|
|
64
|
-
export interface MAColors {
|
|
65
|
-
MA5: string
|
|
66
|
-
MA10: string
|
|
67
|
-
MA20: string
|
|
68
|
-
MA30: string
|
|
69
|
-
MA60: string
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
/** 布林带颜色 */
|
|
73
|
-
export interface BOLLColors {
|
|
74
|
-
UPPER: string
|
|
75
|
-
MIDDLE: string
|
|
76
|
-
LOWER: string
|
|
77
|
-
BAND_FILL: string
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
/** MACD 颜色 */
|
|
81
|
-
export interface MACDColors {
|
|
82
|
-
DIF: string
|
|
83
|
-
DEA: string
|
|
84
|
-
BAR_UP: string
|
|
85
|
-
BAR_UP_LIGHT: string
|
|
86
|
-
BAR_DOWN: string
|
|
87
|
-
BAR_DOWN_LIGHT: string
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
/** 成交量颜色 */
|
|
91
|
-
export interface VolumeColors {
|
|
92
|
-
UP: string
|
|
93
|
-
DOWN: string
|
|
94
|
-
NEUTRAL: string
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
/** RSI 颜色 */
|
|
98
|
-
export interface RSIColors {
|
|
99
|
-
RSI1: string
|
|
100
|
-
RSI2: string
|
|
101
|
-
RSI3: string
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
/** CCI 颜色 */
|
|
105
|
-
export interface CCIColors {
|
|
106
|
-
CCI: string
|
|
107
|
-
OVERBOUGHT: string
|
|
108
|
-
OVERSOLD: string
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
/** KDJ/STOCH 颜色 */
|
|
112
|
-
export interface KDJColors {
|
|
113
|
-
K: string
|
|
114
|
-
D: string
|
|
115
|
-
J: string
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
/** MOM 颜色 */
|
|
119
|
-
export interface MOMColors {
|
|
120
|
-
MOM: string
|
|
121
|
-
ZERO: string
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
/** WMSR 颜色 */
|
|
125
|
-
export interface WMSRColors {
|
|
126
|
-
WMSR: string
|
|
127
|
-
OVERBOUGHT: string
|
|
128
|
-
OVERSOLD: string
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
/** KST 颜色 */
|
|
132
|
-
export interface KSTColors {
|
|
133
|
-
KST: string
|
|
134
|
-
SIGNAL: string
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
/** EXPMA 颜色 */
|
|
138
|
-
export interface EXPMAColors {
|
|
139
|
-
FAST: string
|
|
140
|
-
SLOW: string
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
/** ENE 颜色 */
|
|
144
|
-
export interface ENEColors {
|
|
145
|
-
UPPER: string
|
|
146
|
-
MIDDLE: string
|
|
147
|
-
LOWER: string
|
|
148
|
-
BAND_FILL: string
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
/** 标签专用颜色(收敛硬编码) */
|
|
152
|
-
export interface LabelColors {
|
|
153
|
-
BG: string
|
|
154
|
-
TEXT: string
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
/** 最新价标签颜色 */
|
|
158
|
-
export interface LastPriceLabelColors {
|
|
159
|
-
BG: string
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
/** 成交量价格标记颜色 */
|
|
163
|
-
export interface VolumePriceColors {
|
|
164
|
-
RISE_WITH: string
|
|
165
|
-
RISE_WITHOUT: string
|
|
166
|
-
FALL_WITH: string
|
|
167
|
-
FALL_WITHOUT: string
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
/** Structure 指标颜色 */
|
|
171
|
-
export interface StructureColors {
|
|
172
|
-
HH: string
|
|
173
|
-
HL: string
|
|
174
|
-
LH: string
|
|
175
|
-
LL: string
|
|
176
|
-
CHOCH: string
|
|
177
|
-
BOS: string
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
/** Zones 指标颜色 */
|
|
181
|
-
export interface ZonesColors {
|
|
182
|
-
FVG_BULL_FILL: string
|
|
183
|
-
FVG_BEAR_FILL: string
|
|
184
|
-
FVG_BULL_BORDER: string
|
|
185
|
-
FVG_BEAR_BORDER: string
|
|
186
|
-
OB_BULL_FILL: string
|
|
187
|
-
OB_BEAR_FILL: string
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
/** 主题色值集合 */
|
|
191
|
-
export interface ThemeColors {
|
|
192
|
-
TEXT: TextColors
|
|
193
|
-
PRICE: PriceColors
|
|
194
|
-
TAG_BG: TagBgColors
|
|
195
|
-
BORDER: BorderColors
|
|
196
|
-
GRID: GridColors
|
|
197
|
-
CROSSHAIR: CrosshairColors
|
|
198
|
-
MA: MAColors
|
|
199
|
-
BOLL: BOLLColors
|
|
200
|
-
MACD: MACDColors
|
|
201
|
-
VOLUME: VolumeColors
|
|
202
|
-
RSI: RSIColors
|
|
203
|
-
CCI: CCIColors
|
|
204
|
-
KDJ: KDJColors
|
|
205
|
-
MOM: MOMColors
|
|
206
|
-
WMSR: WMSRColors
|
|
207
|
-
KST: KSTColors
|
|
208
|
-
EXPMA: EXPMAColors
|
|
209
|
-
ENE: ENEColors
|
|
210
|
-
/** 收敛的硬编码色值 */
|
|
211
|
-
LABEL: LabelColors
|
|
212
|
-
LAST_PRICE_LABEL: LastPriceLabelColors
|
|
213
|
-
VOLUME_PRICE: VolumePriceColors
|
|
214
|
-
STRUCTURE: StructureColors
|
|
215
|
-
ZONES: ZonesColors
|
|
216
|
-
WMSR_GRID: string
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
// ==================== Light Theme ====================
|
|
220
|
-
|
|
221
|
-
const lightTextColors: TextColors = {
|
|
222
|
-
PRIMARY: 'hsl(210, 9%, 31%)',
|
|
223
|
-
SECONDARY: 'hsl(210, 9%, 35%)',
|
|
224
|
-
TERTIARY: 'hsl(210, 8%, 50%)',
|
|
225
|
-
WEAK: 'hsl(210, 7%, 65%)',
|
|
226
|
-
WHITE: 'rgba(255, 255, 255, 0.92)',
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
const lightPriceColors: PriceColors = {
|
|
230
|
-
UP: 'rgba(214, 10, 34, 1)',
|
|
231
|
-
UP_LIGHT: 'rgba(214, 10, 34, 0.92)',
|
|
232
|
-
UP_TICK: 'hsl(0, 60%, 50%)',
|
|
233
|
-
DOWN: 'rgba(3, 123, 102, 1)',
|
|
234
|
-
DOWN_LIGHT: 'rgba(3, 123, 102, 0.92)',
|
|
235
|
-
DOWN_TICK: 'hsl(150, 30%, 60%)',
|
|
236
|
-
NEUTRAL: 'rgba(0, 0, 0, 0.78)',
|
|
237
|
-
LAST_PRICE: 'rgba(196, 74, 86, 0.95)',
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
const lightTagBgColors: TagBgColors = {
|
|
241
|
-
WHITE: 'rgb(255, 255, 255)',
|
|
242
|
-
LIGHT_GRAY: 'rgba(255, 255, 255, 0.92)',
|
|
243
|
-
PURE_WHITE: '#ffffff',
|
|
244
|
-
TRANSPARENT: 'transparent',
|
|
245
|
-
ACTIVE: '#1890ff',
|
|
246
|
-
ACTIVE_HOVER: '#40a9ff',
|
|
247
|
-
HOVER: '#f0f0f0',
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
const lightBorderColors: BorderColors = {
|
|
251
|
-
DARK: 'rgba(0, 0, 0, 0.12)',
|
|
252
|
-
MEDIUM: 'rgba(0, 0, 0, 0.10)',
|
|
253
|
-
LIGHT: 'rgba(0, 0, 0, 0.08)',
|
|
254
|
-
SEPARATOR: 'rgba(0, 0, 0, 0.10)',
|
|
255
|
-
BUTTON: '#d0d0d0',
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
const lightGridColors: GridColors = {
|
|
259
|
-
HORIZONTAL: 'rgba(0, 0, 0, 0.06)',
|
|
260
|
-
VERTICAL: 'rgba(0, 0, 0, 0.12)',
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
const lightCrosshairColors: CrosshairColors = {
|
|
264
|
-
LINE: 'rgba(0, 0, 0, 0.28)',
|
|
265
|
-
LABEL_BG: 'rgb(0, 0, 0)',
|
|
266
|
-
LABEL_TEXT: 'rgba(255, 255, 255, 0.92)',
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
const lightMAColors: MAColors = {
|
|
270
|
-
MA5: 'rgba(255, 193, 37, 1)',
|
|
271
|
-
MA10: 'rgba(190, 131, 12, 1)',
|
|
272
|
-
MA20: 'rgba(69, 112, 249, 1)',
|
|
273
|
-
MA30: 'rgba(76, 175, 80, 1)',
|
|
274
|
-
MA60: 'rgba(156, 39, 176, 1)',
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
const lightBOLLColors: BOLLColors = {
|
|
278
|
-
UPPER: 'rgba(178, 34, 34, 1)',
|
|
279
|
-
MIDDLE: 'rgba(69, 112, 249, 1)',
|
|
280
|
-
LOWER: 'rgba(34, 139, 34, 1)',
|
|
281
|
-
BAND_FILL: 'rgba(100, 149, 237, 0.1)',
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
const lightMACDColors: MACDColors = {
|
|
285
|
-
DIF: 'rgba(69, 112, 249, 1)',
|
|
286
|
-
DEA: 'rgba(255, 152, 0, 1)',
|
|
287
|
-
BAR_UP: '#ff5252',
|
|
288
|
-
BAR_UP_LIGHT: '#fccbcd',
|
|
289
|
-
BAR_DOWN: '#22ab94',
|
|
290
|
-
BAR_DOWN_LIGHT: '#ace5dc',
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
const lightVolumeColors: VolumeColors = {
|
|
294
|
-
UP: '#ff5252',
|
|
295
|
-
DOWN: '#22ab94',
|
|
296
|
-
NEUTRAL: 'rgba(0, 0, 0, 0.78)',
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
const lightRSIColors: RSIColors = {
|
|
300
|
-
RSI1: 'rgba(69, 112, 249, 1)',
|
|
301
|
-
RSI2: 'rgba(255, 152, 0, 1)',
|
|
302
|
-
RSI3: 'rgba(156, 39, 176, 1)',
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
const lightCCIColors: CCIColors = {
|
|
306
|
-
CCI: 'rgba(69, 112, 249, 1)',
|
|
307
|
-
OVERBOUGHT: 'rgba(214, 10, 34, 0.5)',
|
|
308
|
-
OVERSOLD: 'rgba(3, 123, 102, 0.5)',
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
const lightKDJColors: KDJColors = {
|
|
312
|
-
K: 'rgba(69, 112, 249, 1)',
|
|
313
|
-
D: 'rgba(255, 152, 0, 1)',
|
|
314
|
-
J: 'rgba(156, 39, 176, 1)',
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
const lightMOMColors: MOMColors = {
|
|
318
|
-
MOM: 'rgba(69, 112, 249, 1)',
|
|
319
|
-
ZERO: 'rgba(0, 0, 0, 0.2)',
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
const lightWMSRColors: WMSRColors = {
|
|
323
|
-
WMSR: 'rgba(69, 112, 249, 1)',
|
|
324
|
-
OVERBOUGHT: 'rgba(214, 10, 34, 0.5)',
|
|
325
|
-
OVERSOLD: 'rgba(3, 123, 102, 0.5)',
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
const lightKSTColors: KSTColors = {
|
|
329
|
-
KST: 'rgba(69, 112, 249, 1)',
|
|
330
|
-
SIGNAL: 'rgba(255, 152, 0, 1)',
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
const lightEXPMAColors: EXPMAColors = {
|
|
334
|
-
FAST: 'rgba(255, 152, 0, 1)',
|
|
335
|
-
SLOW: 'rgba(69, 112, 249, 1)',
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
const lightENEColors: ENEColors = {
|
|
339
|
-
UPPER: 'rgba(214, 10, 34, 1)',
|
|
340
|
-
MIDDLE: 'rgba(69, 112, 249, 1)',
|
|
341
|
-
LOWER: 'rgba(3, 123, 102, 1)',
|
|
342
|
-
BAND_FILL: 'rgba(69, 112, 249, 0.08)',
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
const lightLabelColors: LabelColors = {
|
|
346
|
-
BG: 'rgba(0, 0, 0, 0.8)',
|
|
347
|
-
TEXT: '#ffffff',
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
const lightLastPriceLabelColors: LastPriceLabelColors = {
|
|
351
|
-
BG: 'rgba(255, 247, 248, 0.98)',
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
const lightVolumePriceColors: VolumePriceColors = {
|
|
355
|
-
RISE_WITH: '#FF4444',
|
|
356
|
-
RISE_WITHOUT: '#00C853',
|
|
357
|
-
FALL_WITH: '#FF4444',
|
|
358
|
-
FALL_WITHOUT: '#00C853',
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
const lightStructureColors: StructureColors = {
|
|
362
|
-
HH: '#16a34a',
|
|
363
|
-
HL: '#22c55e',
|
|
364
|
-
LH: '#dc2626',
|
|
365
|
-
LL: '#ef4444',
|
|
366
|
-
CHOCH: '#8b5cf6',
|
|
367
|
-
BOS: '#f59e0b',
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
const lightZonesColors: ZonesColors = {
|
|
371
|
-
FVG_BULL_FILL: 'rgba(34, 197, 94, 0.15)',
|
|
372
|
-
FVG_BEAR_FILL: 'rgba(239, 68, 68, 0.15)',
|
|
373
|
-
FVG_BULL_BORDER: 'rgba(34, 197, 94, 0.6)',
|
|
374
|
-
FVG_BEAR_BORDER: 'rgba(239, 68, 68, 0.6)',
|
|
375
|
-
OB_BULL_FILL: 'rgba(34, 197, 94, 0.25)',
|
|
376
|
-
OB_BEAR_FILL: 'rgba(239, 68, 68, 0.25)',
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
// ==================== Dark Theme ====================
|
|
380
|
-
|
|
381
|
-
const darkTextColors: TextColors = {
|
|
382
|
-
PRIMARY: 'hsl(210, 10%, 85%)',
|
|
383
|
-
SECONDARY: 'hsl(210, 8%, 75%)',
|
|
384
|
-
TERTIARY: 'hsl(210, 6%, 60%)',
|
|
385
|
-
WEAK: 'hsl(210, 5%, 45%)',
|
|
386
|
-
WHITE: 'rgba(255, 255, 255, 0.95)',
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
const darkPriceColors: PriceColors = {
|
|
390
|
-
UP: 'rgba(255, 80, 100, 1)',
|
|
391
|
-
UP_LIGHT: 'rgba(255, 80, 100, 0.85)',
|
|
392
|
-
UP_TICK: 'hsl(0, 70%, 60%)',
|
|
393
|
-
DOWN: 'rgba(60, 200, 160, 1)',
|
|
394
|
-
DOWN_LIGHT: 'rgba(60, 200, 160, 0.85)',
|
|
395
|
-
DOWN_TICK: 'hsl(150, 50%, 65%)',
|
|
396
|
-
NEUTRAL: 'rgba(255, 255, 255, 0.7)',
|
|
397
|
-
LAST_PRICE: 'rgba(230, 100, 115, 0.95)',
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
const darkTagBgColors: TagBgColors = {
|
|
401
|
-
WHITE: 'rgb(40, 40, 55)',
|
|
402
|
-
LIGHT_GRAY: 'rgba(50, 50, 65, 0.92)',
|
|
403
|
-
PURE_WHITE: '#282837',
|
|
404
|
-
TRANSPARENT: 'transparent',
|
|
405
|
-
ACTIVE: '#1890ff',
|
|
406
|
-
ACTIVE_HOVER: '#40a9ff',
|
|
407
|
-
HOVER: '#3a3a4a',
|
|
408
|
-
}
|
|
409
|
-
|
|
410
|
-
const darkBorderColors: BorderColors = {
|
|
411
|
-
DARK: 'rgba(255, 255, 255, 0.15)',
|
|
412
|
-
MEDIUM: 'rgba(255, 255, 255, 0.12)',
|
|
413
|
-
LIGHT: 'rgba(255, 255, 255, 0.08)',
|
|
414
|
-
SEPARATOR: 'rgba(255, 255, 255, 0.10)',
|
|
415
|
-
BUTTON: '#505060',
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
const darkGridColors: GridColors = {
|
|
419
|
-
HORIZONTAL: 'rgba(255, 255, 255, 0.06)',
|
|
420
|
-
VERTICAL: 'rgba(255, 255, 255, 0.10)',
|
|
421
|
-
}
|
|
422
|
-
|
|
423
|
-
const darkCrosshairColors: CrosshairColors = {
|
|
424
|
-
LINE: 'rgba(255, 255, 255, 0.4)',
|
|
425
|
-
LABEL_BG: 'rgb(40, 40, 55)',
|
|
426
|
-
LABEL_TEXT: 'rgba(255, 255, 255, 0.92)',
|
|
427
|
-
}
|
|
428
|
-
|
|
429
|
-
const darkMAColors: MAColors = {
|
|
430
|
-
MA5: 'rgba(255, 200, 50, 1)',
|
|
431
|
-
MA10: 'rgba(200, 150, 30, 1)',
|
|
432
|
-
MA20: 'rgba(90, 140, 255, 1)',
|
|
433
|
-
MA30: 'rgba(90, 190, 95, 1)',
|
|
434
|
-
MA60: 'rgba(170, 60, 195, 1)',
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
const darkBOLLColors: BOLLColors = {
|
|
438
|
-
UPPER: 'rgba(200, 60, 60, 1)',
|
|
439
|
-
MIDDLE: 'rgba(90, 140, 255, 1)',
|
|
440
|
-
LOWER: 'rgba(50, 170, 60, 1)',
|
|
441
|
-
BAND_FILL: 'rgba(120, 170, 255, 0.15)',
|
|
442
|
-
}
|
|
443
|
-
|
|
444
|
-
const darkMACDColors: MACDColors = {
|
|
445
|
-
DIF: 'rgba(90, 140, 255, 1)',
|
|
446
|
-
DEA: 'rgba(255, 170, 50, 1)',
|
|
447
|
-
BAR_UP: '#ff6b6b',
|
|
448
|
-
BAR_UP_LIGHT: '#ffb3b3',
|
|
449
|
-
BAR_DOWN: '#4ecdc4',
|
|
450
|
-
BAR_DOWN_LIGHT: '#a8e6e1',
|
|
451
|
-
}
|
|
452
|
-
|
|
453
|
-
const darkVolumeColors: VolumeColors = {
|
|
454
|
-
UP: '#ff6b6b',
|
|
455
|
-
DOWN: '#4ecdc4',
|
|
456
|
-
NEUTRAL: 'rgba(255, 255, 255, 0.6)',
|
|
457
|
-
}
|
|
458
|
-
|
|
459
|
-
const darkRSIColors: RSIColors = {
|
|
460
|
-
RSI1: 'rgba(90, 140, 255, 1)',
|
|
461
|
-
RSI2: 'rgba(255, 170, 50, 1)',
|
|
462
|
-
RSI3: 'rgba(180, 70, 205, 1)',
|
|
463
|
-
}
|
|
464
|
-
|
|
465
|
-
const darkCCIColors: CCIColors = {
|
|
466
|
-
CCI: 'rgba(90, 140, 255, 1)',
|
|
467
|
-
OVERBOUGHT: 'rgba(255, 80, 100, 0.6)',
|
|
468
|
-
OVERSOLD: 'rgba(60, 200, 160, 0.6)',
|
|
469
|
-
}
|
|
470
|
-
|
|
471
|
-
const darkKDJColors: KDJColors = {
|
|
472
|
-
K: 'rgba(90, 140, 255, 1)',
|
|
473
|
-
D: 'rgba(255, 170, 50, 1)',
|
|
474
|
-
J: 'rgba(180, 70, 205, 1)',
|
|
475
|
-
}
|
|
476
|
-
|
|
477
|
-
const darkMOMColors: MOMColors = {
|
|
478
|
-
MOM: 'rgba(90, 140, 255, 1)',
|
|
479
|
-
ZERO: 'rgba(255, 255, 255, 0.2)',
|
|
480
|
-
}
|
|
481
|
-
|
|
482
|
-
const darkWMSRColors: WMSRColors = {
|
|
483
|
-
WMSR: 'rgba(90, 140, 255, 1)',
|
|
484
|
-
OVERBOUGHT: 'rgba(255, 80, 100, 0.6)',
|
|
485
|
-
OVERSOLD: 'rgba(60, 200, 160, 0.6)',
|
|
486
|
-
}
|
|
487
|
-
|
|
488
|
-
const darkKSTColors: KSTColors = {
|
|
489
|
-
KST: 'rgba(90, 140, 255, 1)',
|
|
490
|
-
SIGNAL: 'rgba(255, 170, 50, 1)',
|
|
491
|
-
}
|
|
492
|
-
|
|
493
|
-
const darkEXPMAColors: EXPMAColors = {
|
|
494
|
-
FAST: 'rgba(255, 170, 50, 1)',
|
|
495
|
-
SLOW: 'rgba(90, 140, 255, 1)',
|
|
496
|
-
}
|
|
497
|
-
|
|
498
|
-
const darkENEColors: ENEColors = {
|
|
499
|
-
UPPER: 'rgba(255, 80, 100, 1)',
|
|
500
|
-
MIDDLE: 'rgba(90, 140, 255, 1)',
|
|
501
|
-
LOWER: 'rgba(60, 200, 160, 1)',
|
|
502
|
-
BAND_FILL: 'rgba(90, 140, 255, 0.12)',
|
|
503
|
-
}
|
|
504
|
-
|
|
505
|
-
const darkLabelColors: LabelColors = {
|
|
506
|
-
BG: 'rgba(30, 30, 40, 0.9)',
|
|
507
|
-
TEXT: '#ffffff',
|
|
508
|
-
}
|
|
509
|
-
|
|
510
|
-
const darkLastPriceLabelColors: LastPriceLabelColors = {
|
|
511
|
-
BG: 'rgba(60, 50, 55, 0.98)',
|
|
512
|
-
}
|
|
513
|
-
|
|
514
|
-
const darkVolumePriceColors: VolumePriceColors = {
|
|
515
|
-
RISE_WITH: '#FF6666',
|
|
516
|
-
RISE_WITHOUT: '#66FF99',
|
|
517
|
-
FALL_WITH: '#FF6666',
|
|
518
|
-
FALL_WITHOUT: '#66FF99',
|
|
519
|
-
}
|
|
520
|
-
|
|
521
|
-
const darkStructureColors: StructureColors = {
|
|
522
|
-
HH: '#4ade80',
|
|
523
|
-
HL: '#22c55e',
|
|
524
|
-
LH: '#f87171',
|
|
525
|
-
LL: '#ef4444',
|
|
526
|
-
CHOCH: '#a78bfa',
|
|
527
|
-
BOS: '#fbbf24',
|
|
528
|
-
}
|
|
529
|
-
|
|
530
|
-
const darkZonesColors: ZonesColors = {
|
|
531
|
-
FVG_BULL_FILL: 'rgba(74, 222, 128, 0.20)',
|
|
532
|
-
FVG_BEAR_FILL: 'rgba(248, 113, 113, 0.20)',
|
|
533
|
-
FVG_BULL_BORDER: 'rgba(74, 222, 128, 0.8)',
|
|
534
|
-
FVG_BEAR_BORDER: 'rgba(248, 113, 113, 0.8)',
|
|
535
|
-
OB_BULL_FILL: 'rgba(74, 222, 128, 0.35)',
|
|
536
|
-
OB_BEAR_FILL: 'rgba(248, 113, 113, 0.35)',
|
|
537
|
-
}
|
|
538
|
-
|
|
539
|
-
// ==================== Theme Collections ====================
|
|
540
|
-
|
|
541
|
-
const lightTheme: ThemeColors = {
|
|
542
|
-
TEXT: lightTextColors,
|
|
543
|
-
PRICE: lightPriceColors,
|
|
544
|
-
TAG_BG: lightTagBgColors,
|
|
545
|
-
BORDER: lightBorderColors,
|
|
546
|
-
GRID: lightGridColors,
|
|
547
|
-
CROSSHAIR: lightCrosshairColors,
|
|
548
|
-
MA: lightMAColors,
|
|
549
|
-
BOLL: lightBOLLColors,
|
|
550
|
-
MACD: lightMACDColors,
|
|
551
|
-
VOLUME: lightVolumeColors,
|
|
552
|
-
RSI: lightRSIColors,
|
|
553
|
-
CCI: lightCCIColors,
|
|
554
|
-
KDJ: lightKDJColors,
|
|
555
|
-
MOM: lightMOMColors,
|
|
556
|
-
WMSR: lightWMSRColors,
|
|
557
|
-
KST: lightKSTColors,
|
|
558
|
-
EXPMA: lightEXPMAColors,
|
|
559
|
-
ENE: lightENEColors,
|
|
560
|
-
LABEL: lightLabelColors,
|
|
561
|
-
LAST_PRICE_LABEL: lightLastPriceLabelColors,
|
|
562
|
-
VOLUME_PRICE: lightVolumePriceColors,
|
|
563
|
-
STRUCTURE: lightStructureColors,
|
|
564
|
-
ZONES: lightZonesColors,
|
|
565
|
-
WMSR_GRID: 'rgba(0, 0, 0, 0.1)',
|
|
566
|
-
}
|
|
567
|
-
|
|
568
|
-
const darkTheme: ThemeColors = {
|
|
569
|
-
TEXT: darkTextColors,
|
|
570
|
-
PRICE: darkPriceColors,
|
|
571
|
-
TAG_BG: darkTagBgColors,
|
|
572
|
-
BORDER: darkBorderColors,
|
|
573
|
-
GRID: darkGridColors,
|
|
574
|
-
CROSSHAIR: darkCrosshairColors,
|
|
575
|
-
MA: darkMAColors,
|
|
576
|
-
BOLL: darkBOLLColors,
|
|
577
|
-
MACD: darkMACDColors,
|
|
578
|
-
VOLUME: darkVolumeColors,
|
|
579
|
-
RSI: darkRSIColors,
|
|
580
|
-
CCI: darkCCIColors,
|
|
581
|
-
KDJ: darkKDJColors,
|
|
582
|
-
MOM: darkMOMColors,
|
|
583
|
-
WMSR: darkWMSRColors,
|
|
584
|
-
KST: darkKSTColors,
|
|
585
|
-
EXPMA: darkEXPMAColors,
|
|
586
|
-
ENE: darkENEColors,
|
|
587
|
-
LABEL: darkLabelColors,
|
|
588
|
-
LAST_PRICE_LABEL: darkLastPriceLabelColors,
|
|
589
|
-
VOLUME_PRICE: darkVolumePriceColors,
|
|
590
|
-
STRUCTURE: darkStructureColors,
|
|
591
|
-
ZONES: darkZonesColors,
|
|
592
|
-
WMSR_GRID: 'rgba(255, 255, 255, 0.1)',
|
|
593
|
-
}
|
|
594
|
-
|
|
595
|
-
/**
|
|
596
|
-
* 根据主题获取颜色配置
|
|
597
|
-
* @param theme - 主题类型 'light' | 'dark'
|
|
598
|
-
* @returns 主题色值集合
|
|
599
|
-
*/
|
|
600
|
-
export function getColors(theme: ChartTheme): ThemeColors {
|
|
601
|
-
return theme === 'dark' ? darkTheme : lightTheme
|
|
602
|
-
}
|
|
603
|
-
|
|
604
|
-
/**
|
|
605
|
-
* 日志颜色(与主题无关,保留常量导出)
|
|
606
|
-
*/
|
|
607
|
-
export const LOG_COLORS = {
|
|
608
|
-
INFO: 'background:#164586;color:#fff;',
|
|
609
|
-
SUCCESS: 'background:#389e0d;color:#fff;',
|
|
610
|
-
WARN: 'background:#d46b08;color:#fff;',
|
|
611
|
-
ERROR: 'background:#cf1322;color:#fff;',
|
|
612
|
-
CONSOLE: '#666',
|
|
613
|
-
} as const
|
|
614
|
-
|
|
615
|
-
/**
|
|
616
|
-
* 工具函数:根据涨跌返回颜色
|
|
617
|
-
* @param type - 涨跌类型
|
|
618
|
-
* @param theme - 主题类型
|
|
619
|
-
* @returns 对应颜色
|
|
620
|
-
*/
|
|
621
|
-
export function getPriceColor(type: 'up' | 'down' | 'neutral', theme: ChartTheme = 'light'): string {
|
|
622
|
-
const colors = getColors(theme)
|
|
623
|
-
switch (type) {
|
|
624
|
-
case 'up':
|
|
625
|
-
return colors.PRICE.UP
|
|
626
|
-
case 'down':
|
|
627
|
-
return colors.PRICE.DOWN
|
|
628
|
-
case 'neutral':
|
|
629
|
-
return colors.PRICE.NEUTRAL
|
|
630
|
-
}
|
|
631
|
-
}
|
|
632
|
-
|
|
633
|
-
/**
|
|
634
|
-
* 工具函数:根据涨跌百分比返回颜色
|
|
635
|
-
* @param changePercent - 涨跌百分比
|
|
636
|
-
* @param theme - 主题类型
|
|
637
|
-
* @returns 对应颜色
|
|
638
|
-
*/
|
|
639
|
-
export function getTickColor(changePercent: number, theme: ChartTheme = 'light'): string {
|
|
640
|
-
const colors = getColors(theme)
|
|
641
|
-
return changePercent >= 0 ? colors.PRICE.UP_TICK : colors.PRICE.DOWN_TICK
|
|
642
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* 主题感知颜色配置
|
|
3
|
+
* 所有颜色通过 getColors(theme) 获取,支持 light/dark 双主题
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/** 主题类型 */
|
|
7
|
+
export type ChartTheme = 'light' | 'dark'
|
|
8
|
+
|
|
9
|
+
/** 文本颜色 */
|
|
10
|
+
export interface TextColors {
|
|
11
|
+
PRIMARY: string
|
|
12
|
+
SECONDARY: string
|
|
13
|
+
TERTIARY: string
|
|
14
|
+
WEAK: string
|
|
15
|
+
WHITE: string
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/** 涨跌价格颜色 */
|
|
19
|
+
export interface PriceColors {
|
|
20
|
+
UP: string
|
|
21
|
+
UP_LIGHT: string
|
|
22
|
+
UP_TICK: string
|
|
23
|
+
DOWN: string
|
|
24
|
+
DOWN_LIGHT: string
|
|
25
|
+
DOWN_TICK: string
|
|
26
|
+
NEUTRAL: string
|
|
27
|
+
LAST_PRICE: string
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** 标签背景颜色 */
|
|
31
|
+
export interface TagBgColors {
|
|
32
|
+
WHITE: string
|
|
33
|
+
LIGHT_GRAY: string
|
|
34
|
+
PURE_WHITE: string
|
|
35
|
+
TRANSPARENT: string
|
|
36
|
+
ACTIVE: string
|
|
37
|
+
ACTIVE_HOVER: string
|
|
38
|
+
HOVER: string
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** 边框颜色 */
|
|
42
|
+
export interface BorderColors {
|
|
43
|
+
DARK: string
|
|
44
|
+
MEDIUM: string
|
|
45
|
+
LIGHT: string
|
|
46
|
+
SEPARATOR: string
|
|
47
|
+
BUTTON: string
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** 网格线颜色 */
|
|
51
|
+
export interface GridColors {
|
|
52
|
+
HORIZONTAL: string
|
|
53
|
+
VERTICAL: string
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** 十字线颜色 */
|
|
57
|
+
export interface CrosshairColors {
|
|
58
|
+
LINE: string
|
|
59
|
+
LABEL_BG: string
|
|
60
|
+
LABEL_TEXT: string
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** 均线颜色 */
|
|
64
|
+
export interface MAColors {
|
|
65
|
+
MA5: string
|
|
66
|
+
MA10: string
|
|
67
|
+
MA20: string
|
|
68
|
+
MA30: string
|
|
69
|
+
MA60: string
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/** 布林带颜色 */
|
|
73
|
+
export interface BOLLColors {
|
|
74
|
+
UPPER: string
|
|
75
|
+
MIDDLE: string
|
|
76
|
+
LOWER: string
|
|
77
|
+
BAND_FILL: string
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/** MACD 颜色 */
|
|
81
|
+
export interface MACDColors {
|
|
82
|
+
DIF: string
|
|
83
|
+
DEA: string
|
|
84
|
+
BAR_UP: string
|
|
85
|
+
BAR_UP_LIGHT: string
|
|
86
|
+
BAR_DOWN: string
|
|
87
|
+
BAR_DOWN_LIGHT: string
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/** 成交量颜色 */
|
|
91
|
+
export interface VolumeColors {
|
|
92
|
+
UP: string
|
|
93
|
+
DOWN: string
|
|
94
|
+
NEUTRAL: string
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/** RSI 颜色 */
|
|
98
|
+
export interface RSIColors {
|
|
99
|
+
RSI1: string
|
|
100
|
+
RSI2: string
|
|
101
|
+
RSI3: string
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/** CCI 颜色 */
|
|
105
|
+
export interface CCIColors {
|
|
106
|
+
CCI: string
|
|
107
|
+
OVERBOUGHT: string
|
|
108
|
+
OVERSOLD: string
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/** KDJ/STOCH 颜色 */
|
|
112
|
+
export interface KDJColors {
|
|
113
|
+
K: string
|
|
114
|
+
D: string
|
|
115
|
+
J: string
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/** MOM 颜色 */
|
|
119
|
+
export interface MOMColors {
|
|
120
|
+
MOM: string
|
|
121
|
+
ZERO: string
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/** WMSR 颜色 */
|
|
125
|
+
export interface WMSRColors {
|
|
126
|
+
WMSR: string
|
|
127
|
+
OVERBOUGHT: string
|
|
128
|
+
OVERSOLD: string
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/** KST 颜色 */
|
|
132
|
+
export interface KSTColors {
|
|
133
|
+
KST: string
|
|
134
|
+
SIGNAL: string
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/** EXPMA 颜色 */
|
|
138
|
+
export interface EXPMAColors {
|
|
139
|
+
FAST: string
|
|
140
|
+
SLOW: string
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/** ENE 颜色 */
|
|
144
|
+
export interface ENEColors {
|
|
145
|
+
UPPER: string
|
|
146
|
+
MIDDLE: string
|
|
147
|
+
LOWER: string
|
|
148
|
+
BAND_FILL: string
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/** 标签专用颜色(收敛硬编码) */
|
|
152
|
+
export interface LabelColors {
|
|
153
|
+
BG: string
|
|
154
|
+
TEXT: string
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/** 最新价标签颜色 */
|
|
158
|
+
export interface LastPriceLabelColors {
|
|
159
|
+
BG: string
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/** 成交量价格标记颜色 */
|
|
163
|
+
export interface VolumePriceColors {
|
|
164
|
+
RISE_WITH: string
|
|
165
|
+
RISE_WITHOUT: string
|
|
166
|
+
FALL_WITH: string
|
|
167
|
+
FALL_WITHOUT: string
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/** Structure 指标颜色 */
|
|
171
|
+
export interface StructureColors {
|
|
172
|
+
HH: string
|
|
173
|
+
HL: string
|
|
174
|
+
LH: string
|
|
175
|
+
LL: string
|
|
176
|
+
CHOCH: string
|
|
177
|
+
BOS: string
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/** Zones 指标颜色 */
|
|
181
|
+
export interface ZonesColors {
|
|
182
|
+
FVG_BULL_FILL: string
|
|
183
|
+
FVG_BEAR_FILL: string
|
|
184
|
+
FVG_BULL_BORDER: string
|
|
185
|
+
FVG_BEAR_BORDER: string
|
|
186
|
+
OB_BULL_FILL: string
|
|
187
|
+
OB_BEAR_FILL: string
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/** 主题色值集合 */
|
|
191
|
+
export interface ThemeColors {
|
|
192
|
+
TEXT: TextColors
|
|
193
|
+
PRICE: PriceColors
|
|
194
|
+
TAG_BG: TagBgColors
|
|
195
|
+
BORDER: BorderColors
|
|
196
|
+
GRID: GridColors
|
|
197
|
+
CROSSHAIR: CrosshairColors
|
|
198
|
+
MA: MAColors
|
|
199
|
+
BOLL: BOLLColors
|
|
200
|
+
MACD: MACDColors
|
|
201
|
+
VOLUME: VolumeColors
|
|
202
|
+
RSI: RSIColors
|
|
203
|
+
CCI: CCIColors
|
|
204
|
+
KDJ: KDJColors
|
|
205
|
+
MOM: MOMColors
|
|
206
|
+
WMSR: WMSRColors
|
|
207
|
+
KST: KSTColors
|
|
208
|
+
EXPMA: EXPMAColors
|
|
209
|
+
ENE: ENEColors
|
|
210
|
+
/** 收敛的硬编码色值 */
|
|
211
|
+
LABEL: LabelColors
|
|
212
|
+
LAST_PRICE_LABEL: LastPriceLabelColors
|
|
213
|
+
VOLUME_PRICE: VolumePriceColors
|
|
214
|
+
STRUCTURE: StructureColors
|
|
215
|
+
ZONES: ZonesColors
|
|
216
|
+
WMSR_GRID: string
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
// ==================== Light Theme ====================
|
|
220
|
+
|
|
221
|
+
const lightTextColors: TextColors = {
|
|
222
|
+
PRIMARY: 'hsl(210, 9%, 31%)',
|
|
223
|
+
SECONDARY: 'hsl(210, 9%, 35%)',
|
|
224
|
+
TERTIARY: 'hsl(210, 8%, 50%)',
|
|
225
|
+
WEAK: 'hsl(210, 7%, 65%)',
|
|
226
|
+
WHITE: 'rgba(255, 255, 255, 0.92)',
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
const lightPriceColors: PriceColors = {
|
|
230
|
+
UP: 'rgba(214, 10, 34, 1)',
|
|
231
|
+
UP_LIGHT: 'rgba(214, 10, 34, 0.92)',
|
|
232
|
+
UP_TICK: 'hsl(0, 60%, 50%)',
|
|
233
|
+
DOWN: 'rgba(3, 123, 102, 1)',
|
|
234
|
+
DOWN_LIGHT: 'rgba(3, 123, 102, 0.92)',
|
|
235
|
+
DOWN_TICK: 'hsl(150, 30%, 60%)',
|
|
236
|
+
NEUTRAL: 'rgba(0, 0, 0, 0.78)',
|
|
237
|
+
LAST_PRICE: 'rgba(196, 74, 86, 0.95)',
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
const lightTagBgColors: TagBgColors = {
|
|
241
|
+
WHITE: 'rgb(255, 255, 255)',
|
|
242
|
+
LIGHT_GRAY: 'rgba(255, 255, 255, 0.92)',
|
|
243
|
+
PURE_WHITE: '#ffffff',
|
|
244
|
+
TRANSPARENT: 'transparent',
|
|
245
|
+
ACTIVE: '#1890ff',
|
|
246
|
+
ACTIVE_HOVER: '#40a9ff',
|
|
247
|
+
HOVER: '#f0f0f0',
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
const lightBorderColors: BorderColors = {
|
|
251
|
+
DARK: 'rgba(0, 0, 0, 0.12)',
|
|
252
|
+
MEDIUM: 'rgba(0, 0, 0, 0.10)',
|
|
253
|
+
LIGHT: 'rgba(0, 0, 0, 0.08)',
|
|
254
|
+
SEPARATOR: 'rgba(0, 0, 0, 0.10)',
|
|
255
|
+
BUTTON: '#d0d0d0',
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
const lightGridColors: GridColors = {
|
|
259
|
+
HORIZONTAL: 'rgba(0, 0, 0, 0.06)',
|
|
260
|
+
VERTICAL: 'rgba(0, 0, 0, 0.12)',
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
const lightCrosshairColors: CrosshairColors = {
|
|
264
|
+
LINE: 'rgba(0, 0, 0, 0.28)',
|
|
265
|
+
LABEL_BG: 'rgb(0, 0, 0)',
|
|
266
|
+
LABEL_TEXT: 'rgba(255, 255, 255, 0.92)',
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
const lightMAColors: MAColors = {
|
|
270
|
+
MA5: 'rgba(255, 193, 37, 1)',
|
|
271
|
+
MA10: 'rgba(190, 131, 12, 1)',
|
|
272
|
+
MA20: 'rgba(69, 112, 249, 1)',
|
|
273
|
+
MA30: 'rgba(76, 175, 80, 1)',
|
|
274
|
+
MA60: 'rgba(156, 39, 176, 1)',
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
const lightBOLLColors: BOLLColors = {
|
|
278
|
+
UPPER: 'rgba(178, 34, 34, 1)',
|
|
279
|
+
MIDDLE: 'rgba(69, 112, 249, 1)',
|
|
280
|
+
LOWER: 'rgba(34, 139, 34, 1)',
|
|
281
|
+
BAND_FILL: 'rgba(100, 149, 237, 0.1)',
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
const lightMACDColors: MACDColors = {
|
|
285
|
+
DIF: 'rgba(69, 112, 249, 1)',
|
|
286
|
+
DEA: 'rgba(255, 152, 0, 1)',
|
|
287
|
+
BAR_UP: '#ff5252',
|
|
288
|
+
BAR_UP_LIGHT: '#fccbcd',
|
|
289
|
+
BAR_DOWN: '#22ab94',
|
|
290
|
+
BAR_DOWN_LIGHT: '#ace5dc',
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
const lightVolumeColors: VolumeColors = {
|
|
294
|
+
UP: '#ff5252',
|
|
295
|
+
DOWN: '#22ab94',
|
|
296
|
+
NEUTRAL: 'rgba(0, 0, 0, 0.78)',
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
const lightRSIColors: RSIColors = {
|
|
300
|
+
RSI1: 'rgba(69, 112, 249, 1)',
|
|
301
|
+
RSI2: 'rgba(255, 152, 0, 1)',
|
|
302
|
+
RSI3: 'rgba(156, 39, 176, 1)',
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
const lightCCIColors: CCIColors = {
|
|
306
|
+
CCI: 'rgba(69, 112, 249, 1)',
|
|
307
|
+
OVERBOUGHT: 'rgba(214, 10, 34, 0.5)',
|
|
308
|
+
OVERSOLD: 'rgba(3, 123, 102, 0.5)',
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
const lightKDJColors: KDJColors = {
|
|
312
|
+
K: 'rgba(69, 112, 249, 1)',
|
|
313
|
+
D: 'rgba(255, 152, 0, 1)',
|
|
314
|
+
J: 'rgba(156, 39, 176, 1)',
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
const lightMOMColors: MOMColors = {
|
|
318
|
+
MOM: 'rgba(69, 112, 249, 1)',
|
|
319
|
+
ZERO: 'rgba(0, 0, 0, 0.2)',
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
const lightWMSRColors: WMSRColors = {
|
|
323
|
+
WMSR: 'rgba(69, 112, 249, 1)',
|
|
324
|
+
OVERBOUGHT: 'rgba(214, 10, 34, 0.5)',
|
|
325
|
+
OVERSOLD: 'rgba(3, 123, 102, 0.5)',
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
const lightKSTColors: KSTColors = {
|
|
329
|
+
KST: 'rgba(69, 112, 249, 1)',
|
|
330
|
+
SIGNAL: 'rgba(255, 152, 0, 1)',
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
const lightEXPMAColors: EXPMAColors = {
|
|
334
|
+
FAST: 'rgba(255, 152, 0, 1)',
|
|
335
|
+
SLOW: 'rgba(69, 112, 249, 1)',
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
const lightENEColors: ENEColors = {
|
|
339
|
+
UPPER: 'rgba(214, 10, 34, 1)',
|
|
340
|
+
MIDDLE: 'rgba(69, 112, 249, 1)',
|
|
341
|
+
LOWER: 'rgba(3, 123, 102, 1)',
|
|
342
|
+
BAND_FILL: 'rgba(69, 112, 249, 0.08)',
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
const lightLabelColors: LabelColors = {
|
|
346
|
+
BG: 'rgba(0, 0, 0, 0.8)',
|
|
347
|
+
TEXT: '#ffffff',
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
const lightLastPriceLabelColors: LastPriceLabelColors = {
|
|
351
|
+
BG: 'rgba(255, 247, 248, 0.98)',
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
const lightVolumePriceColors: VolumePriceColors = {
|
|
355
|
+
RISE_WITH: '#FF4444',
|
|
356
|
+
RISE_WITHOUT: '#00C853',
|
|
357
|
+
FALL_WITH: '#FF4444',
|
|
358
|
+
FALL_WITHOUT: '#00C853',
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
const lightStructureColors: StructureColors = {
|
|
362
|
+
HH: '#16a34a',
|
|
363
|
+
HL: '#22c55e',
|
|
364
|
+
LH: '#dc2626',
|
|
365
|
+
LL: '#ef4444',
|
|
366
|
+
CHOCH: '#8b5cf6',
|
|
367
|
+
BOS: '#f59e0b',
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
const lightZonesColors: ZonesColors = {
|
|
371
|
+
FVG_BULL_FILL: 'rgba(34, 197, 94, 0.15)',
|
|
372
|
+
FVG_BEAR_FILL: 'rgba(239, 68, 68, 0.15)',
|
|
373
|
+
FVG_BULL_BORDER: 'rgba(34, 197, 94, 0.6)',
|
|
374
|
+
FVG_BEAR_BORDER: 'rgba(239, 68, 68, 0.6)',
|
|
375
|
+
OB_BULL_FILL: 'rgba(34, 197, 94, 0.25)',
|
|
376
|
+
OB_BEAR_FILL: 'rgba(239, 68, 68, 0.25)',
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
// ==================== Dark Theme ====================
|
|
380
|
+
|
|
381
|
+
const darkTextColors: TextColors = {
|
|
382
|
+
PRIMARY: 'hsl(210, 10%, 85%)',
|
|
383
|
+
SECONDARY: 'hsl(210, 8%, 75%)',
|
|
384
|
+
TERTIARY: 'hsl(210, 6%, 60%)',
|
|
385
|
+
WEAK: 'hsl(210, 5%, 45%)',
|
|
386
|
+
WHITE: 'rgba(255, 255, 255, 0.95)',
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
const darkPriceColors: PriceColors = {
|
|
390
|
+
UP: 'rgba(255, 80, 100, 1)',
|
|
391
|
+
UP_LIGHT: 'rgba(255, 80, 100, 0.85)',
|
|
392
|
+
UP_TICK: 'hsl(0, 70%, 60%)',
|
|
393
|
+
DOWN: 'rgba(60, 200, 160, 1)',
|
|
394
|
+
DOWN_LIGHT: 'rgba(60, 200, 160, 0.85)',
|
|
395
|
+
DOWN_TICK: 'hsl(150, 50%, 65%)',
|
|
396
|
+
NEUTRAL: 'rgba(255, 255, 255, 0.7)',
|
|
397
|
+
LAST_PRICE: 'rgba(230, 100, 115, 0.95)',
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
const darkTagBgColors: TagBgColors = {
|
|
401
|
+
WHITE: 'rgb(40, 40, 55)',
|
|
402
|
+
LIGHT_GRAY: 'rgba(50, 50, 65, 0.92)',
|
|
403
|
+
PURE_WHITE: '#282837',
|
|
404
|
+
TRANSPARENT: 'transparent',
|
|
405
|
+
ACTIVE: '#1890ff',
|
|
406
|
+
ACTIVE_HOVER: '#40a9ff',
|
|
407
|
+
HOVER: '#3a3a4a',
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
const darkBorderColors: BorderColors = {
|
|
411
|
+
DARK: 'rgba(255, 255, 255, 0.15)',
|
|
412
|
+
MEDIUM: 'rgba(255, 255, 255, 0.12)',
|
|
413
|
+
LIGHT: 'rgba(255, 255, 255, 0.08)',
|
|
414
|
+
SEPARATOR: 'rgba(255, 255, 255, 0.10)',
|
|
415
|
+
BUTTON: '#505060',
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
const darkGridColors: GridColors = {
|
|
419
|
+
HORIZONTAL: 'rgba(255, 255, 255, 0.06)',
|
|
420
|
+
VERTICAL: 'rgba(255, 255, 255, 0.10)',
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
const darkCrosshairColors: CrosshairColors = {
|
|
424
|
+
LINE: 'rgba(255, 255, 255, 0.4)',
|
|
425
|
+
LABEL_BG: 'rgb(40, 40, 55)',
|
|
426
|
+
LABEL_TEXT: 'rgba(255, 255, 255, 0.92)',
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
const darkMAColors: MAColors = {
|
|
430
|
+
MA5: 'rgba(255, 200, 50, 1)',
|
|
431
|
+
MA10: 'rgba(200, 150, 30, 1)',
|
|
432
|
+
MA20: 'rgba(90, 140, 255, 1)',
|
|
433
|
+
MA30: 'rgba(90, 190, 95, 1)',
|
|
434
|
+
MA60: 'rgba(170, 60, 195, 1)',
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
const darkBOLLColors: BOLLColors = {
|
|
438
|
+
UPPER: 'rgba(200, 60, 60, 1)',
|
|
439
|
+
MIDDLE: 'rgba(90, 140, 255, 1)',
|
|
440
|
+
LOWER: 'rgba(50, 170, 60, 1)',
|
|
441
|
+
BAND_FILL: 'rgba(120, 170, 255, 0.15)',
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
const darkMACDColors: MACDColors = {
|
|
445
|
+
DIF: 'rgba(90, 140, 255, 1)',
|
|
446
|
+
DEA: 'rgba(255, 170, 50, 1)',
|
|
447
|
+
BAR_UP: '#ff6b6b',
|
|
448
|
+
BAR_UP_LIGHT: '#ffb3b3',
|
|
449
|
+
BAR_DOWN: '#4ecdc4',
|
|
450
|
+
BAR_DOWN_LIGHT: '#a8e6e1',
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
const darkVolumeColors: VolumeColors = {
|
|
454
|
+
UP: '#ff6b6b',
|
|
455
|
+
DOWN: '#4ecdc4',
|
|
456
|
+
NEUTRAL: 'rgba(255, 255, 255, 0.6)',
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
const darkRSIColors: RSIColors = {
|
|
460
|
+
RSI1: 'rgba(90, 140, 255, 1)',
|
|
461
|
+
RSI2: 'rgba(255, 170, 50, 1)',
|
|
462
|
+
RSI3: 'rgba(180, 70, 205, 1)',
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
const darkCCIColors: CCIColors = {
|
|
466
|
+
CCI: 'rgba(90, 140, 255, 1)',
|
|
467
|
+
OVERBOUGHT: 'rgba(255, 80, 100, 0.6)',
|
|
468
|
+
OVERSOLD: 'rgba(60, 200, 160, 0.6)',
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
const darkKDJColors: KDJColors = {
|
|
472
|
+
K: 'rgba(90, 140, 255, 1)',
|
|
473
|
+
D: 'rgba(255, 170, 50, 1)',
|
|
474
|
+
J: 'rgba(180, 70, 205, 1)',
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
const darkMOMColors: MOMColors = {
|
|
478
|
+
MOM: 'rgba(90, 140, 255, 1)',
|
|
479
|
+
ZERO: 'rgba(255, 255, 255, 0.2)',
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
const darkWMSRColors: WMSRColors = {
|
|
483
|
+
WMSR: 'rgba(90, 140, 255, 1)',
|
|
484
|
+
OVERBOUGHT: 'rgba(255, 80, 100, 0.6)',
|
|
485
|
+
OVERSOLD: 'rgba(60, 200, 160, 0.6)',
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
const darkKSTColors: KSTColors = {
|
|
489
|
+
KST: 'rgba(90, 140, 255, 1)',
|
|
490
|
+
SIGNAL: 'rgba(255, 170, 50, 1)',
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
const darkEXPMAColors: EXPMAColors = {
|
|
494
|
+
FAST: 'rgba(255, 170, 50, 1)',
|
|
495
|
+
SLOW: 'rgba(90, 140, 255, 1)',
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
const darkENEColors: ENEColors = {
|
|
499
|
+
UPPER: 'rgba(255, 80, 100, 1)',
|
|
500
|
+
MIDDLE: 'rgba(90, 140, 255, 1)',
|
|
501
|
+
LOWER: 'rgba(60, 200, 160, 1)',
|
|
502
|
+
BAND_FILL: 'rgba(90, 140, 255, 0.12)',
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
const darkLabelColors: LabelColors = {
|
|
506
|
+
BG: 'rgba(30, 30, 40, 0.9)',
|
|
507
|
+
TEXT: '#ffffff',
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
const darkLastPriceLabelColors: LastPriceLabelColors = {
|
|
511
|
+
BG: 'rgba(60, 50, 55, 0.98)',
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
const darkVolumePriceColors: VolumePriceColors = {
|
|
515
|
+
RISE_WITH: '#FF6666',
|
|
516
|
+
RISE_WITHOUT: '#66FF99',
|
|
517
|
+
FALL_WITH: '#FF6666',
|
|
518
|
+
FALL_WITHOUT: '#66FF99',
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
const darkStructureColors: StructureColors = {
|
|
522
|
+
HH: '#4ade80',
|
|
523
|
+
HL: '#22c55e',
|
|
524
|
+
LH: '#f87171',
|
|
525
|
+
LL: '#ef4444',
|
|
526
|
+
CHOCH: '#a78bfa',
|
|
527
|
+
BOS: '#fbbf24',
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
const darkZonesColors: ZonesColors = {
|
|
531
|
+
FVG_BULL_FILL: 'rgba(74, 222, 128, 0.20)',
|
|
532
|
+
FVG_BEAR_FILL: 'rgba(248, 113, 113, 0.20)',
|
|
533
|
+
FVG_BULL_BORDER: 'rgba(74, 222, 128, 0.8)',
|
|
534
|
+
FVG_BEAR_BORDER: 'rgba(248, 113, 113, 0.8)',
|
|
535
|
+
OB_BULL_FILL: 'rgba(74, 222, 128, 0.35)',
|
|
536
|
+
OB_BEAR_FILL: 'rgba(248, 113, 113, 0.35)',
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
// ==================== Theme Collections ====================
|
|
540
|
+
|
|
541
|
+
const lightTheme: ThemeColors = {
|
|
542
|
+
TEXT: lightTextColors,
|
|
543
|
+
PRICE: lightPriceColors,
|
|
544
|
+
TAG_BG: lightTagBgColors,
|
|
545
|
+
BORDER: lightBorderColors,
|
|
546
|
+
GRID: lightGridColors,
|
|
547
|
+
CROSSHAIR: lightCrosshairColors,
|
|
548
|
+
MA: lightMAColors,
|
|
549
|
+
BOLL: lightBOLLColors,
|
|
550
|
+
MACD: lightMACDColors,
|
|
551
|
+
VOLUME: lightVolumeColors,
|
|
552
|
+
RSI: lightRSIColors,
|
|
553
|
+
CCI: lightCCIColors,
|
|
554
|
+
KDJ: lightKDJColors,
|
|
555
|
+
MOM: lightMOMColors,
|
|
556
|
+
WMSR: lightWMSRColors,
|
|
557
|
+
KST: lightKSTColors,
|
|
558
|
+
EXPMA: lightEXPMAColors,
|
|
559
|
+
ENE: lightENEColors,
|
|
560
|
+
LABEL: lightLabelColors,
|
|
561
|
+
LAST_PRICE_LABEL: lightLastPriceLabelColors,
|
|
562
|
+
VOLUME_PRICE: lightVolumePriceColors,
|
|
563
|
+
STRUCTURE: lightStructureColors,
|
|
564
|
+
ZONES: lightZonesColors,
|
|
565
|
+
WMSR_GRID: 'rgba(0, 0, 0, 0.1)',
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
const darkTheme: ThemeColors = {
|
|
569
|
+
TEXT: darkTextColors,
|
|
570
|
+
PRICE: darkPriceColors,
|
|
571
|
+
TAG_BG: darkTagBgColors,
|
|
572
|
+
BORDER: darkBorderColors,
|
|
573
|
+
GRID: darkGridColors,
|
|
574
|
+
CROSSHAIR: darkCrosshairColors,
|
|
575
|
+
MA: darkMAColors,
|
|
576
|
+
BOLL: darkBOLLColors,
|
|
577
|
+
MACD: darkMACDColors,
|
|
578
|
+
VOLUME: darkVolumeColors,
|
|
579
|
+
RSI: darkRSIColors,
|
|
580
|
+
CCI: darkCCIColors,
|
|
581
|
+
KDJ: darkKDJColors,
|
|
582
|
+
MOM: darkMOMColors,
|
|
583
|
+
WMSR: darkWMSRColors,
|
|
584
|
+
KST: darkKSTColors,
|
|
585
|
+
EXPMA: darkEXPMAColors,
|
|
586
|
+
ENE: darkENEColors,
|
|
587
|
+
LABEL: darkLabelColors,
|
|
588
|
+
LAST_PRICE_LABEL: darkLastPriceLabelColors,
|
|
589
|
+
VOLUME_PRICE: darkVolumePriceColors,
|
|
590
|
+
STRUCTURE: darkStructureColors,
|
|
591
|
+
ZONES: darkZonesColors,
|
|
592
|
+
WMSR_GRID: 'rgba(255, 255, 255, 0.1)',
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
/**
|
|
596
|
+
* 根据主题获取颜色配置
|
|
597
|
+
* @param theme - 主题类型 'light' | 'dark'
|
|
598
|
+
* @returns 主题色值集合
|
|
599
|
+
*/
|
|
600
|
+
export function getColors(theme: ChartTheme): ThemeColors {
|
|
601
|
+
return theme === 'dark' ? darkTheme : lightTheme
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
/**
|
|
605
|
+
* 日志颜色(与主题无关,保留常量导出)
|
|
606
|
+
*/
|
|
607
|
+
export const LOG_COLORS = {
|
|
608
|
+
INFO: 'background:#164586;color:#fff;',
|
|
609
|
+
SUCCESS: 'background:#389e0d;color:#fff;',
|
|
610
|
+
WARN: 'background:#d46b08;color:#fff;',
|
|
611
|
+
ERROR: 'background:#cf1322;color:#fff;',
|
|
612
|
+
CONSOLE: '#666',
|
|
613
|
+
} as const
|
|
614
|
+
|
|
615
|
+
/**
|
|
616
|
+
* 工具函数:根据涨跌返回颜色
|
|
617
|
+
* @param type - 涨跌类型
|
|
618
|
+
* @param theme - 主题类型
|
|
619
|
+
* @returns 对应颜色
|
|
620
|
+
*/
|
|
621
|
+
export function getPriceColor(type: 'up' | 'down' | 'neutral', theme: ChartTheme = 'light'): string {
|
|
622
|
+
const colors = getColors(theme)
|
|
623
|
+
switch (type) {
|
|
624
|
+
case 'up':
|
|
625
|
+
return colors.PRICE.UP
|
|
626
|
+
case 'down':
|
|
627
|
+
return colors.PRICE.DOWN
|
|
628
|
+
case 'neutral':
|
|
629
|
+
return colors.PRICE.NEUTRAL
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
/**
|
|
634
|
+
* 工具函数:根据涨跌百分比返回颜色
|
|
635
|
+
* @param changePercent - 涨跌百分比
|
|
636
|
+
* @param theme - 主题类型
|
|
637
|
+
* @returns 对应颜色
|
|
638
|
+
*/
|
|
639
|
+
export function getTickColor(changePercent: number, theme: ChartTheme = 'light'): string {
|
|
640
|
+
const colors = getColors(theme)
|
|
641
|
+
return changePercent >= 0 ? colors.PRICE.UP_TICK : colors.PRICE.DOWN_TICK
|
|
642
|
+
}
|