Repository navigation
Fix find bar and scrollbar legibility over dark themes (#101) - #103
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The implementation matches the stated root cause/constraints, is covered by targeted regression tests, and includes the required documentation updates.
Pull request overview
Improves AppKit chrome legibility (find/replace bar controls and scrollbar knob) when a dark editor theme is used while macOS is in Light appearance, by deriving chrome styling from the theme background instead of the system appearance.
Changes:
- Add
EditorScrollViewto force an appropriateNSAppearanceonto the find bar subtree and keep it updated when the bar is created/shown. - Add
MopedTheme.prefersDarkChrome(background-luminance based) and apply it fromMopedTextViewto both the find bar appearance andscrollerKnobStyle. - Add focused regression tests and update user-facing docs/checklists to cover the behavior.
File summaries
| File | Description |
|---|---|
| MopedEditor/Tests/MopedEditorTests/ThemeTests.swift | Adds tests validating prefersDarkChrome across shipped themes and edge backgrounds. |
| MopedEditor/Tests/MopedEditorTests/FindBarChromeTests.swift | Adds regression tests ensuring find bar appearance is applied to all nested controls and is updated on theme switches. |
| MopedEditor/Sources/MopedEditor/MopedTextView.swift | Uses EditorScrollView and applies chrome appearance/knob style during theme application. |
| MopedEditor/Sources/MopedEditor/EditorTheme.swift | Introduces MopedTheme.prefersDarkChrome based on background luma. |
| MopedEditor/Sources/MopedEditor/EditorScrollView.swift | New scroll view subclass that recursively applies appearance to the find bar view hierarchy. |
| manual-checklist.md | Extends manual verification checklist for dark-theme-in-Light-mode find bar and scrollbar visibility. |
| DOCUMENTATION.md | Documents that find bar styling follows theme background lightness. |
| CHANGELOG.md | Adds a 3.0.1 “Fixed” entry describing the issue and resolution. |
Review details
- Files reviewed: 8/8 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #101.
The problem
With a dark theme in Light mode, the find bar showed nothing but its search field — Done, the ‹ › arrows, the options menu and the whole replace row were invisible. Over the reporter's pure-black theme they composited to exactly
#000000; the controls were there and clickable, just painted the colour of their backdrop. Reproduces with the shipped Turbo theme, so it was never specific to a custom.mopedtheme.Cause
Three things, each of which had to be established by measurement rather than assumption:
backgroundColor— not the scroll view's and not the clip view's. A three-colour probe confirmed it: the bar strip took the text view's colour.NSBannerViewinside it — dumping the live hierarchy showed the root readingdarkAquawhile every child still readaqua.The change
EditorScrollView(new) overridesfindBarView/isFindBarVisibleand pushes an appearance chosen from the theme's background luminance down the bar's whole subtree, re-applying on create, show and theme switch.MopedTheme.prefersDarkChromemakes that choice; the scrollbar knob style, which had the same dark-on-dark problem, comes from the same check.The appearance is deliberately not set on the scroll view or the text view:
MopedTextViewderives its resolved palette fromeffectiveAppearance, so an appearance picked from the palette's own background and applied to an ancestor would make a paired theme flip to its other half. A test covers that.Verification
Real app on macOS 26.5.2 in Light mode — the same OS build the reporter is on:
swift test --package-path MopedEditor: 229 tests, 0 failuresswiftlint --strict: 0 violations across 96 files./scripts/check_localized_strings.sh: passedA standalone harness does not reproduce this — same editor, even hosted in SwiftUI, draws a normal dark material. It has to be checked in the real app.
Docs: CHANGELOG Fixed entry under 3.0.1, a sentence in DOCUMENTATION's Finding and navigating, and the find-bar line in
manual-checklist.mdextended with the dark-theme-in-Light-mode case.🤖 Generated with Claude Code