Skip to content

Fix find bar and scrollbar legibility over dark themes (#101) - #103

Merged
RobertoMachorro merged 1 commit into
masterfrom
claude/theme-issue-101-caaa12
Aug 22, 2026
Merged

RobertoMachorro merged 1 commit into
masterfrom
claude/theme-issue-101-caaa12

Conversation

@RobertoMachorro

Copy link
Copy Markdown
Owner

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:

  1. AppKit paints the find bar over the text view's 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.
  2. The bar's controls are drawn for the system appearance. Dark theme background + Light-appearance controls = dark on dark.
  3. Setting the appearance on the bar's root view does not reach the controls. AppKit pins an explicit appearance on the NSBannerView inside it — dumping the live hierarchy showed the root reading darkAqua while every child still read aqua.

The change

EditorScrollView (new) overrides findBarView / isFindBarVisible and 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.prefersDarkChrome makes 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: MopedTextView derives its resolved palette from effectiveAppearance, 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:

  • Turbo, ⌘F and ⌘⌥F: Done, ‹ ›, options menu and replace row all legible
  • Solarized (light theme): unchanged
  • swift test --package-path MopedEditor: 229 tests, 0 failures
  • swiftlint --strict: 0 violations across 96 files
  • ./scripts/check_localized_strings.sh: passed

A 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.md extended with the dark-theme-in-Light-mode case.

🤖 Generated with Claude Code

Copilot AI lite review requested due to automatic review settings August 22, 2026 23:49
@RobertoMachorro RobertoMachorro self-assigned this Aug 22, 2026
@RobertoMachorro RobertoMachorro added bug Something isn't working enhancement New feature or request labels Aug 22, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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 EditorScrollView to force an appropriate NSAppearance onto the find bar subtree and keep it updated when the bar is created/shown.
  • Add MopedTheme.prefersDarkChrome (background-luminance based) and apply it from MopedTextView to both the find bar appearance and scrollerKnobStyle.
  • 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.

@RobertoMachorro
RobertoMachorro merged commit 58a28c6 into master Aug 22, 2026
2 checks passed
@RobertoMachorro
RobertoMachorro deleted the claude/theme-issue-101-caaa12 branch August 22, 2026 23:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

backcolor color set to black doesn't show the find/replace bar correctly

2 participants