Why do you need to update the styles via javascript. Do you need to update something beyond dark/light scheme declarations in CSS? Can you clarify what you need with the javascript function?
Reasons:
RegEx Blacklisted phrase (2.5): Can you clarify what you