在 Dash Plotly 中设置背景颜色

Set background color in Dash Plotly

我正在开发 Dash 应用程序,我正在尝试通过创建一个 .css 文件来为整个页面设置背景颜色,其中我有:

body{
    background-color: darkcyan;
    margin: 0;
}

问题是颜色是正确的,但如果有用 dcc.Graph

创建的图表,我仍然有白色部分

颜色为深青色,但不适用于图表。 这是我的绘图创建代码:

dcc.Graph(figure=fig_length,
          style={'width': '33%', 'display': 'inline-block', 'horizontal-align': 'right','vertical-align': 'up',"margin-top":"30px"}),
dcc.Graph(figure=fig_numbers,
          style={'width': '33%', 'display': 'inline-block',"margin-top":"30px"}),
dcc.Graph(figure=fig_clasification,
          style={'width': '33%', 'display': 'inline-block',"margin-top":"30px"}),

html.Div([
          dcc.Checklist(
          id="all-or-none",
          options=[{"label": "Select All", "value": "All"}],
          value=[],
          labelStyle={'margin-top': '10px'}
          )],style={"font-family": "Helvetica"}),
html.Div([
          dcc.Checklist(
          id='checklist_journals',
          options=[{'label': x, 'value': x, 'disabled': False}
                   for x in sorted(journals) #set in alphabetical order
                    ],
          value=sorted(journals)[0:15],
          labelStyle={'display': 'block','margin-left':'40px','margin-top':'10px'}
          )],style={'width': '33%', 'display': 'inline-block',"overflow-y":"scroll","height": "350px","font-family": "Helvetica"}), #'backgroundColor':'blue'
html.Div([dcc.Graph(id='journals_pie',figure=fig_pie_journals)],
          style={'width': '33%', 'display': 'inline-block',"font-family": "Helvetica"}),
html.Div([dcc.Graph(id='journals_graph', figure=fig1)],
         style={'width': '33%', 'display': 'inline-block',"font-family": "Helvetica"}),

我不明白为什么检查表是彩色的,而其他图表是白色的。

试试这个图表:

colors = {
    'background': '#111111',
    'text': '#7FDBFF'
}

 dcc.Graph(
        id='example-graph-2',
        figure={
            'layout': {
                'plot_bgcolor': colors['background'],
                'paper_bgcolor': colors['background'],
                'font': {
                    'color': colors['text']
                }
            }