【问题标题】:TradingView - unable to set color for top toolbarTradingView - 无法设置顶部工具栏的颜色
【发布时间】:2022-12-12 04:53:37
【问题描述】:

我的电视图表有以下设置覆盖:

    let chartStyleOverrides = {
      'scalesProperties.bgColor': bgColor,
      'paneProperties.background': bgColor,
      'paneProperties.backgroundType': 'solid',
      'paneProperties.legendProperties.showBackground': false,
    };

他们改变了除了最上面的栏之外所有东西的颜色(你可以看到它是白色而不是灰色)。

如何更改顶部栏的颜色?

【问题讨论】:

    标签: tradingview-api


    【解决方案1】:

    我只设法使用自定义 CSS 选项来做到这一点,它的工作原理如下:

    创建一个类似custom.css 的 CSS 文件,内容如下:

    .theme-dark:root {
        --tv-color-platform-background: #222222;
        --tv-color-pane-background: #222222;
        --tv-color-pane-background-secondary: #222222;
    }
    

    然后在实例化 TradingView 小部件时将此选项添加到选项列表中:

    custom_css_url: '../custom.css',
    

    如果您使用像 webpack 这样的捆绑器,请确保将 CSS 文件保存到您的公共文件夹中。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-02-22
      • 2021-12-24
      • 2015-01-07
      • 1970-01-01
      相关资源
      最近更新 更多