Skip to content

fix(copilot): respect widget theme for logo URL - #2981

Open
axelray-dev wants to merge 2 commits into
Chainlit:mainfrom
axelray-dev:fix/copilot-logo-theme-2976
Open

fix(copilot): respect widget theme for logo URL#2981
axelray-dev wants to merge 2 commits into
Chainlit:mainfrom
axelray-dev:fix/copilot-logo-theme-2976

Conversation

@axelray-dev

@axelray-dev axelray-dev commented Jul 14, 2026

Copy link
Copy Markdown

Summary

In the Copilot widget, the logo URL was following the OS color scheme instead of the widget theme (mount config or vite-ui-theme in localStorage).

Root cause: Header renders the shared frontend Logo, which reads the frontend ThemeProvider context. That provider is not mounted in the copilot tree, so the logo fell back to system / prefers-color-scheme.

Changes

  • Add optional themeVariant prop on frontend/src/components/Logo.tsx. When set, it is used for getLogoEndpoint; otherwise existing useTheme() behavior is unchanged for the main app.
  • Pass copilot useTheme().variant from libs/copilot/src/components/Header.tsx into Logo.
  • Add a Vitest regression that forces themeVariant="light" and asserts the logo endpoint is called with light.

Verification

  • pnpm Vitest for frontend/tests/Logo.spec.tsx
  • Frontend typecheck
  • Copilot production build
  • ESLint and Prettier on touched files

Fixes #2976


Summary by cubic

Fixes the Copilot widget logo so it follows the widget theme (mount config or vite-ui-theme) instead of the OS color scheme, ensuring the correct light/dark logo URL.

  • Bug Fixes
    • Added optional themeVariant prop on Logo; default behavior unchanged.
    • In Copilot Header, pass useTheme().variant into Logo so getLogoEndpoint uses the widget theme.
    • Added a Vitest test: themeVariant="light" triggers getLogoEndpoint('light', ...).

Written for commit 41e7fd2. Summary will update on new commits.

Review in cubic

Fixes Chainlit#2976

Co-Authored-By: Codex <codex@openai.com>
@axelray-dev
axelray-dev marked this pull request as ready for review July 14, 2026 08:40
@dosubot dosubot Bot added size:S This PR changes 10-29 lines, ignoring generated files. bug Something isn't working frontend Pertains to the frontend. unit-tests Has unit tests. labels Jul 14, 2026

@cubic-dev-ai cubic-dev-ai Bot 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.

No issues found across 3 files

Re-trigger cubic

@dokterbob

Copy link
Copy Markdown
Collaborator

@codex review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working frontend Pertains to the frontend. size:S This PR changes 10-29 lines, ignoring generated files. unit-tests Has unit tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Copilot logo ignores widget theme/localStorage — Logo reads an unprovided theme context and follows OS prefers-color-scheme

2 participants