             // Change the statusItem image to include rays to
             // indicate that dont sleep mode is on.
             statusItem.image = NSImage(named: "SunnyRays")
-        
+            
+            // Set image as a template in order for dark mode changes to take effect.
+            statusItem.image?.setTemplate(true)
+            
             // Create the assertion that will prevent the application from sleeping.
             success = IOPMAssertionCreateWithName(kIOPMAssertPreventUserIdleDisplaySleep,
                                                   IOPMAssertionLevel(kIOPMAssertionLevelOn),

    
    /// Status for the assertion depicting the reason for the activity.
    var reasonForActivity = "DontSleep is on -- so don't sleep!" as CFString

    // MARK: Methods
    
    func applicationDidFinishLaunching(aNotification: NSNotification) {

            // Change the status menu item back to the default image.
            statusItem.image = NSImage(named: "Sunny")
            
            // Set image as a template in order for dark mode changes to take effect.
            statusItem.image?.setTemplate(true)
            
            // If the assertion previously succeeded, relase it.
            if success == kIOReturnSuccess {
                IOPMAssertionRelease(assertionID);
