I see you are using the theme switch components and Bootstrap themed figure templates a from the bootstrap-templates
library.
Try making the figure template match the theme. Then the dark figure template will be displayed with the dark theme.
Currently, you have::
The figure templates:
template_theme1 = 'spacelab'
template_theme2 = 'cyborg'
Themes for the toggle switch:
url_theme1 = dbc.themes.CYBORG
url_theme2 = dbc.themes.SPACELAB
So the first theme is CYBORG
, which is dark, but the figure template is 'spacelab'
which is light. Try making template_theme1='cyborg'
instead. Then it will have the dark background.
One more tip – you will have better results if you define your app with first theme:
Currently you start with the BOOTSTRAP theme:
app = dash.Dash(__name__, server=server, suppress_callback_exceptions=True,
external_stylesheets=[dbc.themes.BOOTSTRAP, dbc_css])
Try this instead:
app = dash.Dash(__name__, server=server, suppress_callback_exceptions=True,
external_stylesheets=[url_theme1, dbc_css])