Reference an element from another file to add a class name on click

How can I change the color an element on click of a button? I’m trying to implement a ‘dark mode’ in an application.

The first line of this function works fine. It sets the theme of the header to “dark”, but I want to grab an element in a different file and set the background color as well.

I tried adding a classname and directly adding a style to it from here.
image.png