Skip to content

fix: render the default variant's scheme on first launch - #1

Merged
demolaf merged 5 commits into
mainfrom
fix/first-launch-color-scheme
Sep 27, 2026
Merged

demolaf merged 5 commits into
mainfrom
fix/first-launch-color-scheme

Conversation

@demolaf

@demolaf demolaf commented Sep 27, 2026 •

Copy link
Copy Markdown
Owner

Stops ThemeApplier from rendering the first frame of a first launch in fallback.colorScheme, and applies the default variant's scheme on first appear in both the SwiftUI and UIKit appliers.

Changes

  • Until a value is persisted, ThemeKitSwiftUI.ThemeApplier renders the scheme of the default variant value it is about to store, so a first launch no longer renders in the fallback's scheme and flips, which left macOS window titles and sidebar text resolved light.
  • Both appliers now apply the stored default's scheme on first appear. SwiftUI relied on onChange(of: theme.value), which never fires when the default equals fallback; UIKit's observation starts after onAppear().
  • Documents fallback.colorScheme in ThemeExtension.swift and REFERENCE.md, adds a 0.3.1 CHANGELOG entry (dated at tag time), and makes check_changelog_entry.swift reject an Unreleased heading.
  • Adds first-launch tests for light, dark, unspecified and always-dark defaults, covering NSApplication.shared.appearance and overrideUserInterfaceStyle.

ThemeApplier forced the first frame of a first launch to fallback.colorScheme, then flipped once handleAppear stored the default variant. It now follows the system until a value is persisted, and applies the stored scheme on first appear instead of relying on onChange(of: theme.value), which does not fire when the default equals fallback.
Correct the fallback.colorScheme doc for undecodable stored values and mirror it in REFERENCE.md, inline effectiveColorScheme, tidy the changelog entry, regroup and tighten the tests, cover an unspecified default, and fail the changelog check on an Unreleased heading.
handleAppear stored the default variant on first launch but never set overrideUserInterfaceStyle, and theme observation starts after onAppear(), so the window was left unforced for the first session.
Cover an unspecified default, route the new tests through makeApplier, note the harmless double application, and tighten the changelog wording.
Following the system on first launch still flipped for a default variant that forces a scheme different from the system's, such as an always-dark palette on a light system. Render the scheme of the value handleAppear is about to store instead.
@demolaf demolaf changed the title fix: follow the system scheme on first launch until a theme is stored fix: render the default variant's scheme on first launch Sep 27, 2026
@demolaf
demolaf merged commit b6cdc3b into main Sep 27, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant