Skip to content

Bug with constantly reverting back to light mode quicklook, even though OSX is in dark #309

Open
@seaders

Description

@seaders

I think this bug is best shown with a screenrecord:

darklight.mov.mp4

You can see that it's showing up as very bright light, despite me being in dark mode. When I then change to OSX's light mode, it changes to dark for a second (I think incorrectly?), and then back to light. Then I switch back to dark mode, and it does nothing. Then I go light mode, dark mode again, and it shows as dark mode, properly now, but when I go to another file, it's back in light mode again.

I looked in the code, as per the advice here https://developer.apple.com/documentation/uikit/supporting-dark-mode-in-your-interface which had this snippet

    observation = NSApp.observe(\.effectiveAppearance) { (app, _) in
        app.effectiveAppearance.performAsCurrentDrawingAppearance {
            // Invoke your non-view code that needs to be aware of the
            // change in appearance.
        }
    }

But the only reference to effectiveAppearance in the code is here,

    /// Check if the appearance is Dark
    lazy var isDarkMode: Bool = {
        // fixme: nell'estensione non sempre restituisce il valore aggiornato!
        if let appearance = self.view.effectiveAppearance.bestMatch(from: [.darkAqua, .aqua]) {
            return appearance == .darkAqua
        }
        return false
    }()

Which seems to be where the problem is. The fixme there is translated as

in the extension it does not always return the updated value

But yeah, for my experience, it's not a sometimes issue, this is never right, for me, when in dark mode.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions