# Initialize the \`SystemAppearance\` using the app's global window appearance \(\#7508\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/c322179bb99fe98b2b5be281cfd23d0cbef9a3c6)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: c322179bb99fe98b2b5be281cfd23d0cbef9a3c6

Requested commit: c322179bb99fe98b2b5be281cfd23d0cbef9a3c6

Commit: c322179bb99fe98b2b5be281cfd23d0cbef9a3c6

Tree: 3c35fb368892b61771e5e660b19edd6b15de892e

Author: Marshall Bowers

Committer: GitHub

## Message

```
Initialize the `SystemAppearance` using the app's global window appearance (#7508)

This PR changes our approach to initializing the `SystemAppearance` so
that we can do it earlier in the startup process.

Previously we were using the appearance from the window, meaning that we
couldn't initialize the value until we first opened the window.

Now we read the `window_appearance` from the `AppContext`. On macOS this
is backed by the
[`effectiveAppearance`](https://developer.apple.com/documentation/appkit/nsapplication/2967171-effectiveappearance)
on the `NSApplication`.

We currently still watch for changes to the appearance at the window
level, as the only hook I could find in the documentation is
[`viewDidChangeEffectiveAppearance`](https://developer.apple.com/documentation/appkit/nsview/2977088-viewdidchangeeffectiveappearance),
which is at the `NSView` level.

In my testing this makes it so Zed appropriately chooses the correct
light/dark theme on startup.

Release Notes:

- N/A
```

## Parents

- [b59e110c5996cc503a1b1cc63a3dfcd99b527709](https://git.cafe/gitcafe/zed/commit/b59e110c5996cc503a1b1cc63a3dfcd99b527709?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/c322179bb99fe98b2b5be281cfd23d0cbef9a3c6?format=markdown)
