Skip to content

Fix titlebar icons invisible when sidebar closed with dark Ghostty theme in light macOS - #482

Closed
serafimcloud wants to merge 3 commits into
manaflow-ai:mainfrom
serafimcloud:fix/titlebar-icon-tint-follow-theme
Closed

serafimcloud wants to merge 3 commits into
manaflow-ai:mainfrom
serafimcloud:fix/titlebar-icon-tint-follow-theme

Conversation

@serafimcloud

@serafimcloud serafimcloud commented Feb 25, 2026 •

Copy link
Copy Markdown

Problem

When using a dark Ghostty theme (e.g. Cursor Dark #141414) with macOS light system appearance and the sidebar closed, the three titlebar icons (sidebar toggle, bell, plus) are invisible — they're dark/black (from macOS light appearance) on a dark titlebar background (from Ghostty theme).

The titlebar background correctly derives its color from the Ghostty theme, but the icons have no explicit foreground color, so they inherit from the macOS system appearance.

Solution

When the sidebar is closed, derive icon color from GhosttyApp.shared.defaultBackgroundColor.isLightColor:

  • Dark Ghostty theme → light icons
  • Light Ghostty theme → dark icons

When the sidebar is open, leave icons unchanged — they use the default system appearance color, which is correct since the sidebar background comes from the system theme, not Ghostty.

Test plan

  • Dark Ghostty theme + light macOS + sidebar closed → icons should be light/visible
  • Dark Ghostty theme + light macOS + sidebar open → icons use default system color
  • Dark Ghostty theme + dark macOS + sidebar closed → icons light/visible
  • Light Ghostty theme + sidebar closed → icons dark/visible

🤖 Generated with Claude Code

… color

The titlebar control icons (sidebar toggle, notifications bell, new tab plus)
were rendered with the default macOS system accent color (blue) because no
foreground color was specified. This looked out of place with dark themes
like Cursor Dark. Apply .foregroundStyle(.secondary) to match the neutral
appearance used elsewhere in the UI.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@vercel

vercel Bot commented Feb 25, 2026

Copy link
Copy Markdown

@serafimcloud is attempting to deploy a commit to the Manaflow Team on Vercel.

A member of the Team first needs to authorize it.

…ility

Use GhosttyApp.shared.defaultBackgroundColor to determine whether the
terminal theme is light or dark, then set icon foreground accordingly.
This matches the same approach used by fakeTitlebarTextColor in ContentView
and ensures the sidebar, bell, and plus icons are visible on both light
and dark Ghostty themes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@serafimcloud serafimcloud changed the title Fix titlebar icons using system accent color instead of theme color Fix titlebar icons not visible on dark themes when sidebar is closed Feb 25, 2026
When sidebar is open, icons sit on the system-themed sidebar background
so they should use the default system appearance color. When sidebar is
closed, the titlebar background comes from the Ghostty theme, so icons
need to derive their color from GhosttyApp.shared.defaultBackgroundColor
to remain visible.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@serafimcloud serafimcloud changed the title Fix titlebar icons not visible on dark themes when sidebar is closed Fix titlebar icons invisible when sidebar closed with dark Ghostty theme in light macOS Feb 25, 2026
@lawrencecchen

Copy link
Copy Markdown
Contributor

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 28f1473bf4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

}

private var iconForegroundColor: Color? {
let sidebarVisible = AppDelegate.shared?.sidebarState?.isVisible ?? false

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Use window-local sidebar visibility for icon tint

iconForegroundColor reads AppDelegate.shared?.sidebarState?.isVisible, but AppDelegate.sidebarState is a single active-window pointer that gets reassigned in setActiveMainWindow (Sources/AppDelegate.swift). TitlebarControlsView is instantiated per window, so in multi-window sessions this can tint icons using another window’s sidebar state (for example, a window with an open sidebar can still get the “sidebar closed” tint when a different window is active), which reintroduces low-contrast icons in the wrong window.

Useful? React with 👍 / 👎.

@lawrencecchen

Copy link
Copy Markdown
Contributor

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 28f1473bf4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +483 to +486
let sidebarVisible = AppDelegate.shared?.sidebarState?.isVisible ?? false
guard !sidebarVisible else { return nil }
let bg = GhosttyApp.shared.defaultBackgroundColor
return bg.isLightColor

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Bind icon tint to observable state

iconForegroundColor now derives the icon tint from AppDelegate.shared?.sidebarState?.isVisible and GhosttyApp.shared.defaultBackgroundColor, but TitlebarControlsView does not observe either source, so SwiftUI has no guaranteed invalidation when sidebar visibility or Ghostty theme changes. In practice, toggling the sidebar via keyboard/CLI or changing theme at runtime can leave stale icon colors (including the original invisible-on-dark case) until an unrelated re-render happens (e.g. hover or notification updates).

Useful? React with 👍 / 👎.

@teamleaderleo

Copy link
Copy Markdown
Collaborator

Thanks for this! Titlebar icons now take their color from the terminal background landed on main in #4359. You opened this first, so you got there first. Closing since main covers it now.

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.

3 participants