Repository navigation
Widget: keep its own field colors on dark pages, and an opt-in dark appearance - #472
Merged
Merged
Conversation
A host page that declares color-scheme: dark made the browser draw the chat input, the Settings fields and the scrollbars in its dark scheme, and text with no color of its own took the host's light text color. The container now declares color-scheme: light, and the panel, the chat input and the Settings fields set their own colors. Applies to every community; on a light page only typed text changes, to #1f2937. Tested: test-widget-capsule.js (bubble regression) and test-widget-tools.js pass against this version.
WidgetConfig.color_scheme is 'light' (the default, omitted from the API response) or 'auto', which follows the reader's device. NEMAR sets auto; a test holds every other community to the light default. Tested: test_community.py and test_communities_endpoint.py.
An osa-dark class, set when colorScheme is 'dark', or 'auto' on a dark device (followed live), carries dark tokens and overrides for every literal color. OSAChatWidget.setColorScheme passes a host page's own choice, outranks the community's, and reaches the pop-out. accent_color moves to --osa-accent-on-light so the dark panel can replace it with theme_color, lifted toward white only if it reads under 4.5:1. A light widget gets no class, no inline property and no media listener. Tested: test-widget-color-scheme.js (67 checks, 26 mutations caught), test-widget-capsule.js, test-widget-tools.js.
Every other real community must declare no client tool, no runtime and no notebook section. Tested: fails when NEMAR's own config is left among the others.
color-scheme-check.mjs starts from a dark host page, with a control proving Chrome draws a plain input dark there, then checks a light community's fields and NEMAR's auto, host override and pop-out. Tested: both modes pass in Chrome 153; seven mutations each fail.
Tested: docs only.
Contributor
Preview Deployment
This preview will be updated automatically when you push new commits. |
WidgetConfigResponse.color_scheme is Literal['auto'] | None: resolve() omits light, and dark is never a community's to send, so the response model guards that whichever code path builds it. Tested: test_community.py, built from resolve() as the route does.
From the PR #472 review: - a community config's color_scheme is taken only as light or auto - the dark accent is measured on the assistant's bubble as well as the panel, so the platform blue now lifts to #6692f1; darkAccentFor takes the raw theme color and has no unreachable fallback - no matchMedia warns once and stays light; addListener-only browsers (Safari before 14) still follow the device - reaching the pop-out and the pop-out failing are reported apart - warnings name the accepted values - tests: computed color-scheme instead of a source regex, every dark rule read back (hover and ::before from the parsed stylesheet), each JS constant held to its stylesheet value, black lifted short of white Tested: test-widget-color-scheme.js (128 checks); 46 mutations caught.
color-scheme-check.mjs --serve starts its own two widget_e2e.py servers (the default config, and --color-scheme auto, a new harness flag that avoids --nemar's live recipe fetch) and runs in the Python 3.12 job of both workflows. From the review: every readiness wait stops the run, the light run checks the config applied, the page-policy rewrite records its own failures, and a runner without Chrome fails under CI. Tested: --serve passes locally in Chrome 153; seven mutations each fail.
NEMAR's config no longer says nemar.org already passes its theme on; the accent figures cover both dark surfaces; the older-browser behavior and the CI checks are documented. Tested: docs and a YAML comment only.
2 tasks
Member
Author
Review responseFour Sonnet reviewers (code, tests, error handling, docs). Every finding is addressed below; the code review found no bugs in the three hard constraints (light widgets untouched, the accent rename, the pop-out carry-over). Tests
Error handling
Code
Docs
Re-verified after the fixes: the whole pytest suite (2927 passed), every Bun suite, ruff, |
neuromechanist
added a commit
that referenced
this pull request
Sep 24, 2026
Release review: add the widget's Notebook tab (#471, #474), color_scheme auto (#472), the first-paint fix (#476) and the dark-page field colors; the capsule and notebook-site bullets described the notebook opening in a new tab, which #474 replaced. Tested: docs-only; each claim checked against origin/develop (config.yaml color_scheme, osa-widget-config- key, ADR 0012 path).
neuromechanist
added a commit
that referenced
this pull request
Sep 24, 2026
* Title the changelog's release as 0.8.14 Tested: docs only. * Complete the 0.8.14 changelog Release review: add the widget's Notebook tab (#471, #474), color_scheme auto (#472), the first-paint fix (#476) and the dark-page field colors; the capsule and notebook-site bullets described the notebook opening in a new tab, which #474 replaced. Tested: docs-only; each claim checked against origin/develop (config.yaml color_scheme, osa-widget-config- key, ADR 0012 path).
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #469. On a dark-themed host page the widget's chat input turned dark inside the light panel. This fixes that for every community, and gives the widget an opt-in dark appearance that NEMAR turns on.
The fix every community gets
A host page that declares
color-scheme: darkmakes the browser draw any form control without colors of its own in its dark field colors, and text without a color of its own inherits the host page's. The container now declarescolor-scheme: light, and the panel, the chat input and the Settings fields set their own colors. On a light host page the only visible change is typed text, and any panel text that used to inherit the host page's color, becoming the widget's#1f2937.The dark appearance, opt-in
widget.color_scheme:light(default, omitted from the API response) orauto, which follows the reader's device, including a switch while the page is open. Only NEMAR setsauto, and a test holds every other community to the default.darkis never a community's: the config, the response model and the widget each refuse it from that side. A browser withoutmatchMedialeavesautolight with a warning; Safari before 14 follows the device throughaddListener.OSAChatWidget.setColorScheme('light' | 'dark' | 'auto'): for a host page with its own theme switch (nemar.org's). It outranks the community's value, works before or afterinit()(before, with no flash of the light panel), and reaches the pop-out, both at opening and afterward.'dark'works for any community whose host page asks for it.setConfig({colorScheme})takes the same values.accent_colorwas chosen to read on white (NEMAR's#257a92is 3.6:1 on the dark panel and 3.0:1 on the assistant's bubble), so the inline property moves to--osa-accent-on-light, and the dark panel usestheme_coloritself (NEMAR's teal: 8.0:1 and 6.6:1). A theme color under 4.5:1 on either surface is mixed with white in 10% steps until it reads on both; the platform blue becomes#6692f1(5.9:1 and 4.9:1). The configured disclaimer colors give way the same way.osa-darkclass, no extra inline property, and no media-query listener.Also in this PR
extensions.client_tools,runtime) and the notebook (notebook) to NEMAR, the way the other NEMAR-only widget settings are held.docs/community-widget.md: a "Light and dark" section and thesetConfigrow.Found along the way, not fixed here
Today's pop-out is written into
about:blank, inherits its opener's Content-Security-Policy, and runs its scripts inline, so on a host page withoutscript-src 'unsafe-inline'it opens blank. nemar.org allows'unsafe-inline', so it works there; the browser harness's stricter policy does not. The pop-out is rebuilt in #470, which should load the script by URL instead. The Chrome check below runs its pop-out step under nemar.org's livescript-src.Tests
frontend/test-widget-color-scheme.js(new, in both workflows), 128 checks on the real widget source in happy-dom: a light community on a dark device is unchanged;autofollows the device, including a live switch and anaddListener-only browser, and stays light with one warning withoutmatchMedia; the host's choice outranks the community's before and afterinit(); invalid values from the host,setConfig, the server (includingdark) or a pop-out preset are ignored with a warning naming the accepted values; every color the dark block replaces is read back, on the widget's own elements where it renders them, from the parsed stylesheet for:hoverand::before, and must differ on a light widget; each JavaScript constant is held to its stylesheet value; the accent kept, lifted to the first step that reads on both surfaces (black stops at#999999), and cleared when stale; whatopenPopoutwrites, and the pop-out keeping its host's choice.frontend/browser-harness/color-scheme-check.mjs --serve, now in CI (Python 3.12 job of both workflows): starts its own twowidget_e2e.pyservers (the default config, and a new--color-scheme autoflag, so CI does not depend on--nemar's live recipe fetch). On a dark host page, with a control proving Chrome draws a plain input dark there, a light community's chat input, Settings key field and model menu stay white with the widget's text color;autofollows an emulated device switch,setColorScheme('light')outranks a dark device, and the pop-out keeps the host's choice, then follows it to dark. Seven mutations, each failing it.test-widget-capsule.js(the bubble regression) andtest-widget-tools.jspass, the latter with its accent assertions moved to the new property; both also pass against the field-color commit alone.Not in this PR
setColorSchemefrom its theme switch (website PR).