In this darkmode code I allow the user to set the theme through system preferences while also allowing the user to override the system preferred theme
theme
system preferences