|
|
@@ -45,7 +45,13 @@ Chart.JSConsole.Chart.Log = () => ({})
|
|
|
Chart.JSConsole.Complier.Log = () => ({})
|
|
|
|
|
|
const setChartStyle = (defaultTheme?: keyof typeof AppTheme) => {
|
|
|
+ const rootElement = document.documentElement
|
|
|
+ const computedStyles = window.getComputedStyle(rootElement)
|
|
|
+ const upBarColor = computedStyles.getPropertyValue('--color-up') // 上涨颜色
|
|
|
+ const downBarColor = computedStyles.getPropertyValue('--color-down') // 下跌颜色
|
|
|
+
|
|
|
const chartEl = chartRef.value
|
|
|
+
|
|
|
if (chartEl) {
|
|
|
const jsChart = Chart.JSChart
|
|
|
const hqChartStyle = Chart.HQChartStyle
|
|
|
@@ -56,12 +62,30 @@ const setChartStyle = (defaultTheme?: keyof typeof AppTheme) => {
|
|
|
switch (theme) {
|
|
|
case AppTheme.Dark: {
|
|
|
const blackStyle = hqChartStyle.GetStyleConfig(Chart.STYLE_TYPE_ID.BLACK_ID) // 黑色风格
|
|
|
+ blackStyle.UpBarColor = upBarColor
|
|
|
+ blackStyle.DownBarColor = downBarColor
|
|
|
+ blackStyle.UpTextColor = upBarColor
|
|
|
+ blackStyle.DownTextColor = downBarColor
|
|
|
+ blackStyle.FrameLatestPrice = {
|
|
|
+ UpBarColor: upBarColor,
|
|
|
+ DownBarColor: downBarColor
|
|
|
+ }
|
|
|
+
|
|
|
jsChart.SetStyle(blackStyle)
|
|
|
elStyle.setProperty('background-color', '#000')
|
|
|
break
|
|
|
}
|
|
|
default: {
|
|
|
const whiteStyle = hqChartStyle.GetStyleConfig(Chart.STYLE_TYPE_ID.WHITE_ID) // 白色风格
|
|
|
+ whiteStyle.UpBarColor = upBarColor
|
|
|
+ whiteStyle.DownBarColor = downBarColor
|
|
|
+ whiteStyle.UpTextColor = upBarColor
|
|
|
+ whiteStyle.DownTextColor = downBarColor
|
|
|
+ whiteStyle.FrameLatestPrice = {
|
|
|
+ UpBarColor: upBarColor,
|
|
|
+ DownBarColor: downBarColor
|
|
|
+ }
|
|
|
+
|
|
|
jsChart.SetStyle(whiteStyle)
|
|
|
elStyle.setProperty('background-color', '#fff')
|
|
|
}
|