From b722cc277e77bafa79bc00ea130e58c2cc58c083 Mon Sep 17 00:00:00 2001 From: "Timo K." Date: Tue, 8 Sep 2026 17:02:24 +0200 Subject: [PATCH] Make the theme a prop, next to the language MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The theme is state — what Element Call should look like right now — and so belongs beside `language` as a prop, not on the imperative handle (where it was a request, `setTheme`, because the internal host bridge speaks the widget API and a widget's host sends theme changes as requests) and not in the configuration (where `config.theme` only ever set the starting theme). The `theme` prop feeds the same channel the rest of Element Call listens to for a host's theme, replayed so that whatever subscribes after the host has set it still hears the current one. Changing it re-themes the container and nothing else; unlike the language, it is per component. `setTheme` and `config.theme` are gone, and the harness gets a theme picker in place of its per-pane buttons. Co-Authored-By: Claude Fable 5.1 --- README.md | 3 ++- component/dev/Harness.tsx | 31 +++++++++++----------- component/host.test.ts | 56 ++++++++++++++++++++++++++++----------- component/host.ts | 22 ++++++++++----- component/index.tsx | 25 ++++++++++------- 5 files changed, 89 insertions(+), 48 deletions(-) diff --git a/README.md b/README.md index b1c462759..b27602906 100644 --- a/README.md +++ b/README.md @@ -248,7 +248,8 @@ The component speaks every language the app does. English is bundled in; the other locales are split into chunks the host's bundler loads the first time they are needed. It starts in the browser's language, and follows the host's own language setting through the `language` prop (`supportedLanguages` lists -the tags it accepts). +the tags it accepts). The `theme` prop works the same way for `light` and +`dark`; both can change while a call is running without disturbing it. The package is not published yet. A host installs it as a git dependency on the `component` directory of this repository, diff --git a/component/dev/Harness.tsx b/component/dev/Harness.tsx index 9e40e2c7a..ded9155a9 100644 --- a/component/dev/Harness.tsx +++ b/component/dev/Harness.tsx @@ -94,9 +94,10 @@ interface LogEntry { const Pane: FC<{ session: Session; roomId: string; + theme: string | undefined; language: string | undefined; log: (pane: string, message: string) => void; -}> = ({ session, roomId, language, log }): ReactNode => { +}> = ({ session, roomId, theme, language, log }): ReactNode => { const [mounted, setMounted] = useState(true); const bridge = useMemo( @@ -139,20 +140,6 @@ const Pane: FC<{ - - +