Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def event(self, ev):
"""Catch system events."""
if ev.type() == QEvent.PaletteChange: # detect theme switches
style = interface_style() # light or dark
if style is not None:
QIcon.setThemeName(style)
else:
QIcon.setThemeName("light") # fallback
return super().event(ev)