Black Lives Matter. Please consider donating to Black Girls Code today.

Access to body style element using callback

Hello!
I’m using Dash in combination with flask: login, responsible toggle sidebar, graphs…
Now I want to change the overall background depending on the page content. For example I see a full size image on login page and a white background on page1. To add a background I use the css-file and I’ve defined it in the ‘body’ section. Is there any possibility to access this body element using callback? e.g.:

@app.callback(
Output(“body”, “style”),
[Input(“url”, “pathname”)],
)
def change_bg(pathname):
if pathname == “/” or pathname == ‘/login’:
return {‘background-image’ : ‘url(/assests/image.jpg’)}
else:
return {‘background-image’ : 'url()}

Thanks in advance
EffEff