Skip to content

Add a titlebar button to choose System, Light or Dark appearance - #7

Merged
flopitaux-ts merged 1 commit into
mainfrom
appearance-toggle
Oct 19, 2026
Merged

flopitaux-ts merged 1 commit into
mainfrom
appearance-toggle

Conversation

@flopitaux-ts

Copy link
Copy Markdown
Collaborator

Why

Since v1.8.0 the app follows the macOS appearance, but there was no way to override it, for example to keep Spotter light on a dark Mac.

What changed

  • Titlebar button between the Org switcher and Logout. Each click cycles System → Light → Dark. The button shows the current mode with an icon, and its tooltip names the next one.
  • Main process: the choice is saved as appearance in spotter-config.json and validated against the three modes. It's applied with nativeTheme.themeSource before the window opens, so the first paint already uses it. The existing nativeTheme updated handler repaints the window background when it changes.
  • Preload: adds getAppearance / setAppearance.
  • Analytics: tracks Appearance Changed with the chosen mode.

How it themes the embed

themeSource is what prefers-color-scheme reports to every page in the app, so one value themes the app's own screens and the embedded Spotter together. The embed follows the system color scheme by default. If a user has explicitly picked a theme in their ThoughtSpot preferences, the embed may keep that; I haven't checked this.

The SDK's isDarkMode / HostEvent.UpdateTheme would let the host force the embed's theme, but it needs ThoughtSpot 26.12, so it isn't used yet. Once clusters are on 26.12, passing this same choice through it would make the theme authoritative.

Testing

On the dev build, against champagne.thoughtspotstaging.cloud, on a copy of the profile:

  • Starting from no saved value, the button shows System. Clicking cycles Light → Dark → System. Each step updates the label, themeSource, the saved config value and the window background (#FFFFFF / #1F2024).
  • Screenshots in Light and Dark show the app and the embed switching together.
  • With appearance: "light" saved, a relaunch starts with themeSource=light and the button shows Light.
  • npm run lint and the production build pass.

In one run the button first showed Dark with no saved value. I couldn't reproduce that on a fresh profile copy, and nothing writes dark without a click.

🤖 Generated with Claude Code

The app followed the macOS appearance with no way to override it. The new titlebar button cycles System → Light → Dark. The choice is saved in spotter-config.json and applied before the window opens, so the first paint is already right.

It sets nativeTheme.themeSource, which is what prefers-color-scheme reports to every page in the app. That themes the app's own screens and the embedded Spotter together: the embed follows the system color scheme unless the user picked a theme in ThoughtSpot itself. The SDK's isDarkMode would let the host force the embed's theme, but it needs ThoughtSpot 26.12.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@flopitaux-ts
flopitaux-ts merged commit 434940d into main Oct 19, 2026
4 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