Skip to content

Fix icon appearance in dark mode: macOS Dock, iOS home screen, notification badges - #1225

Merged
SawyerHood merged 4 commits into
get-bb:mainfrom
vburojevic:fix/dark-mode-icons
Aug 9, 2026
Merged

SawyerHood merged 4 commits into
get-bb:mainfrom
vburojevic:fix/dark-mode-icons

Conversation

@vburojevic

Copy link
Copy Markdown
Contributor

What happened

With macOS in dark mode, the Dock icon renders correctly while bb is closed, then flips to the light rendering (black glyph on a white tile) the moment the app launches.

The same family of bug exists on the web-app side: the iOS home-screen icon (installed PWA) is a glyph on transparency, which iOS renders on black and can't derive dark/tinted home-screen treatments from, and the manifests ship no purpose: "monochrome" icons, so platform tinting and Web Push notification badges have no alpha mask to work with.

What I expected

The Dock icon should keep the system's dark-mode rendering while the app is running, and installed-app icons / notification badges should participate in each platform's appearance treatment.

Root cause (Dock)

apps/desktop/src/main.ts calls app.dock.setIcon(iconPath) on every launch. That replaces the bundle's .icns with a raw NSImage, and programmatically set dock images bypass macOS's appearance pipeline entirely — the system gives them the default light treatment.

The call is redundant for packaged builds: run-electron-builder.mjs already bakes the channel-correct icon (icon.icns / icon-nightly.icns) into the bundle. Its only real purpose is dev runs, where the unpackaged Electron binary needs icon-dev.png to be distinguishable.

Changes

  • Desktop: only call dock.setIcon when !isPackaged. Packaged builds keep the bundle icon and the system's dark rendering.
  • Web app: apple-touch-icon*.png are now full-bleed opaque (glyph on white tile, matching the maskable design); the generator tints them in tile mode so color variants keep the glyph gradient. Added purpose: "monochrome" white-on-transparent alpha-mask icons (derived from glyph darkness) to all manifests — these enable Android themed-icon tinting and give Web Push service workers a correct badge asset (a full-color icon there renders as a solid silhouette blob).

Verification

  • A/B build: identical source packaged with and without the guard, both running simultaneously in a dark-mode Dock — the unguarded build reproduces the white tile, the guarded one keeps the system dark rendering.
  • @bb/desktop: typecheck + 231 tests pass. @bb/app: typecheck + 2446 tests pass, including the generate-pwa-icons --check gate (all color variants and manifests regenerated via the script).
  • Monochrome asset verified as a clean alpha mask (white bb glyph) composited on a dark background.

🤖 Generated with Claude Code

vburojevic and others added 2 commits August 9, 2026 09:22
The desktop app called app.dock.setIcon() on every launch, replacing the
bundle's channel-correct .icns with a raw NSImage. Programmatically set
dock images bypass macOS's appearance treatment, so on macOS 26 in dark
mode the Dock icon flipped to the light rendering the moment the app
opened.

Packaged builds don't need the call at all — electron-builder already
bakes the right icon per release channel into the bundle. Only dev runs
still set the icon, so an unpackaged instance shows icon-dev.png instead
of the stock Electron icon.

Verified with an A/B build: identical source packaged with and without
the guard, running side by side in a dark-mode Dock — the unguarded
build reproduces the white tile, the guarded one keeps the system's
dark rendering.

Co-Authored-By: Claude Fable 5 <[email protected]>
Two icon-appearance fixes for the web app:

- apple-touch-icon*.png were glyphs on transparency. iOS renders
  transparency in touch icons as black, and the home-screen dark/tinted
  treatments need a full-bleed opaque source. The base icon is now the
  glyph on a white tile (matching the maskable design), and the
  generator tints it in tile mode so color variants keep the glyph
  gradient instead of flattening it.

- The manifests had no purpose:"monochrome" icons, so platform tinting
  (Android themed icons, notification badge masks) had nothing to work
  with. The generator now derives white-on-transparent alpha masks from
  the glyph's darkness and every manifest references them; monochrome
  entries are color-independent, so all color-variant manifests share
  the same assets.

Co-Authored-By: Claude Fable 5 <[email protected]>
@SawyerHood

Copy link
Copy Markdown
Collaborator

🚨 SLOP COP 🚨 · review

I am SlopCop. I am reviewing this pull request for security, code quality, performance, architecture, and end-to-end behavior. I will post one final review after the parallel checks finish.

Comment thread apps/app/scripts/generate-pwa-icons.mjs Outdated
// Opaque white tile: iOS renders transparency in touch icons as black,
// and the system's dark/tinted home-screen treatments need a full-bleed
// opaque source.
{ file: "apple-touch-icon.png", mode: "tile" },

@SawyerHood SawyerHood Aug 9, 2026 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

🚨 slopcop/review — The @bb/web touch icon remains transparent

apps/web/src/routes/__root.tsx still serves apps/web/public/apple-touch-icon.png. This generator updates only apps/app/public.

The old web icon still has transparent pixels, so its iOS home-screen fault remains. Generate both icons from one source.

Add a check that confirms that each touch-icon pixel is opaque.

Comment thread apps/app/scripts/generate-pwa-icons.mjs Outdated
// Opaque white tile: iOS renders transparency in touch icons as black,
// and the system's dark/tinted home-screen treatments need a full-bleed
// opaque source.
{ file: "apple-touch-icon.png", mode: "tile" },

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

🚨 slopcop/review — The new mode makes the glyph path unreachable

Every icon now uses tile mode. Thus, tintGlyphIcon and the glyph branch cannot run.

Remove the unused function and the unused mode branch.

@SawyerHood SawyerHood left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

🚨 SLOP COP 🚨 · review

ELI5: This PR gives the mobile icons a solid background. It also lets macOS keep the correct packaged Dock icon after launch.

I found one P2 issue and one non-blocking cleanup issue.

  • P2: @bb/web still serves its old transparent Apple touch icon. This leaves one iOS home-screen surface unfixed.

  • P3: All generated icons now use tile mode. The old glyph function and branch can no longer run.

I found no security or privacy issue. I found no important performance regression.

The P2 should receive a fix before merge. The generator should use one source for both Apple touch icons.

Checks completed:

  • The exact head SHA and base SHA matched the pull request.

  • git diff --check and the generated-asset check passed.

  • Turbo typechecks passed for @bb/app and @bb/desktop.

  • All 2,446 app tests and all 231 desktop tests passed.

  • Chromium loaded all nine manifests and all icon URLs successfully.

  • The default and blue Apple touch icons were 180×180 pixels and fully opaque.

  • The monochrome icons had valid alpha masks.

I did not repeat the packaged macOS Dock visual test. That check needs a packaged app and a direct Dock comparison.

I posted this result as a comment review. I did not approve the pull request or request changes.

SawyerHood and others added 2 commits August 9, 2026 16:31
Every icon entry uses tile mode, so the glyph branch and tintGlyphIcon
can never run. Remove them and reduce the icon list to file names.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
apps/web served the original transparent 180x180 icon, so the iOS home
screen rendered its transparency as black. Use the same white-flattened
asset that apps/app now ships; both files were already identical.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@SawyerHood
SawyerHood merged commit cc26d45 into get-bb:main Aug 9, 2026
9 checks passed
amadad pushed a commit to amadad/bb that referenced this pull request Aug 14, 2026
…cation badges (get-bb#1225)

## What happened

With macOS in dark mode, the Dock icon renders correctly while bb is
closed, then flips to the light rendering (black glyph on a white tile)
the moment the app launches.

The same family of bug exists on the web-app side: the iOS home-screen
icon (installed PWA) is a glyph on transparency, which iOS renders on
black and can't derive dark/tinted home-screen treatments from, and the
manifests ship no `purpose: "monochrome"` icons, so platform tinting and
Web Push notification badges have no alpha mask to work with.

## What I expected

The Dock icon should keep the system's dark-mode rendering while the app
is running, and installed-app icons / notification badges should
participate in each platform's appearance treatment.

## Root cause (Dock)

`apps/desktop/src/main.ts` calls `app.dock.setIcon(iconPath)` on every
launch. That replaces the bundle's `.icns` with a raw `NSImage`, and
programmatically set dock images bypass macOS's appearance pipeline
entirely — the system gives them the default light treatment.

The call is redundant for packaged builds: `run-electron-builder.mjs`
already bakes the channel-correct icon (`icon.icns` /
`icon-nightly.icns`) into the bundle. Its only real purpose is dev runs,
where the unpackaged Electron binary needs `icon-dev.png` to be
distinguishable.

## Changes

- **Desktop:** only call `dock.setIcon` when `!isPackaged`. Packaged
builds keep the bundle icon and the system's dark rendering.
- **Web app:** `apple-touch-icon*.png` are now full-bleed opaque (glyph
on white tile, matching the maskable design); the generator tints them
in tile mode so color variants keep the glyph gradient. Added `purpose:
"monochrome"` white-on-transparent alpha-mask icons (derived from glyph
darkness) to all manifests — these enable Android themed-icon tinting
and give Web Push service workers a correct `badge` asset (a full-color
icon there renders as a solid silhouette blob).

## Verification

- A/B build: identical source packaged with and without the guard, both
running simultaneously in a dark-mode Dock — the unguarded build
reproduces the white tile, the guarded one keeps the system dark
rendering.
- `@bb/desktop`: typecheck + 231 tests pass. `@bb/app`: typecheck + 2446
tests pass, including the `generate-pwa-icons --check` gate (all color
variants and manifests regenerated via the script).
- Monochrome asset verified as a clean alpha mask (white bb glyph)
composited on a dark background.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Fable 5 <[email protected]>
Co-authored-by: Sawyer Hood <[email protected]>
SawyerHood pushed a commit that referenced this pull request Sep 3, 2026
## Human comments

## What was wrong

The Expo app supplied only the top-level light icon, so Expo generated
no dark-appearance entry in the iOS asset catalog. As a result, the
native icon can remain a black mark on a white tile when the iPhone Home
Screen changes to its dark appearance, unlike the installed PWA icon
treatment.

## What changed

- Added an explicit `ios.icon` light/dark pair. The light path keeps the
current app icon, and the dark path gives Expo an appearance-specific
source.
- Added `apps/mobile/assets/icon-dark.png`, a 1024×1024 white luminance
mask on transparency derived from the current light icon. It preserves
the current mark geometry and lets the system-provided dark background
show through.
- Android and splash assets are unchanged. There are no wire, CLI, SDK,
guide, or host-daemon protocol changes.

References:

- [Expo: use `ios.icon` for light, dark, and tinted
variants](https://docs.expo.dev/develop/user-interface/splash-screen-and-app-icon/#ios)
- [Apple: configure Light, Dark, and Tinted asset-catalog
variants](https://developer.apple.com/documentation/xcode/configuring-your-app-icon)
- [Earlier PWA dark/tinted icon
treatment](#1225)
- [Dark icon source
preview](https://github.com/salemsayed/bb/blob/4c37bbd3d/apps/mobile/assets/icon-dark.png)
(transparent white artwork; GitHub shows transparency in its image
viewer)

## How you verified

- Ran `npx expo prebuild --platform ios --no-install`. Expo generated an
opaque `[email protected]` and a transparent
`[email protected]`; `Contents.json` tagged the latter with
`appearance: luminosity`, `value: dark`.
- Verified both sources are 1024×1024 sRGB PNGs, the dark source has
alpha from 0 through 1, and compositing it on black is pixel-identical
to the luminance inverse of the current light icon.
- Ran `npx -y [email protected] exec turbo run typecheck lint test
--filter=@bb/mobile --force`: all six Turbo tasks passed and all 326
mobile tests passed. Lint reported four existing React warnings and no
errors.

I could not perform the final SpringBoard check because this environment
is Linux and I do not control the project TestFlight release. Maintainer
verification requested: please install a preview/TestFlight build on iOS
18 or later, leave Home Screen icon appearance on Automatic, switch the
phone between Light and Dark, and confirm the Home Screen, Settings, and
Search icon treatments. Adding the `mobile-e2e` label will also exercise
the Release simulator build path.

Fixes #

> AGENT GENERATED
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.

2 participants