Skip to content

fix(cli): export keeps a built one-mode theme in its mode in any viewer - #12683

Closed
josephfarina wants to merge 1 commit into
mainfrom
josephfarina/rl-export-light-only
Closed

josephfarina wants to merge 1 commit into
mainfrom
josephfarina/rl-export-light-only

Conversation

@josephfarina

@josephfarina josephfarina commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

User impact

Someone exports a page whose theme draws in light only (a theme with no dark tokens, such as a retro desktop theme) and opens the file in a viewer that is set to dark mode. The page turns black-on-black: the viewer paints its dark canvas, and the theme's dark text sits on it. The same file written for a dark-only theme must stay dark in a light viewer, or Core's tracks and fills, which follow the page's scheme, turn light under the theme's dark surfaces.

Problem and solution fit

  • Why it happens: the file declared both color schemes for every page, so a dark viewer took the dark scheme even when the page's theme has no dark colors.
  • Why it harms the task: the shared page is unreadable for anyone whose system is in dark mode.
  • Why that matters: the file is meant to show the page readably in any viewer.

The fix reads which modes the page's root theme draws. It uses the theme's colorModes export when it has one. Otherwise the page and text colors the theme's root sets in the stylesheets the page imports (its built stylesheet, or the page's own CSS) decide: a light page with dark text draws in light only, and a dark page with light text in dark only. A page whose theme draws in one mode declares only that scheme and paints the theme's own page color on the document, so it stays readable in a viewer of the other scheme.

Expected behavior and authority

The owner's decision on this pull request: a page whose theme draws in one mode is exported in that mode, so a light-only theme stays light in a dark viewer. The file keeps the theme's one mode, read from colorModes or inferred from its root page and text colors. For a theme without colorModes this differs from an app: theme add passes such a theme no mode, so in the app its Theme follows the viewer. A theme that draws in both modes, or a page with no theme, keeps following the viewer.

Smallest restoration

  • foundation/discovery/color-modes.mjs: one shared reader of a theme's modes. It reads the theme module's colorModes export statically, following re-exports, without running the module (the same reader theme add and the theme preview use), and keeps a two-mode export as its own value.
  • experimental export and render() docs and the share-a-page guide: the file follows the viewer's scheme unless the page's root theme draws in one mode, which the file keeps.
  • foundation/discovery/module-exports.mjs: exports resolvePackageModule, the package's exports map, else its module, main or index file, for a bare specifier, which the theme module lookup uses.
  • foundation/color/css-color.mjs (with css-color.test.mjs, which pins its formula copies to the generated palette engine over a grid): the theme editor's CSS color reader (hex, named colors, rgb(), hsl(), oklch() and the other CSS color forms) and its relative luminance move here unchanged, so the theme editor and the export read colors one way. api/theme-edit/_color.mjs, _css.mjs and _tables.mjs import them from there. The palette's color.mjs is generated from Core and stays as generated; the reader keeps its own OKLab-to-linear and sRGB-to-linear helpers (the same formulas), because foundation/ never imports from api/.
  • foundation/render/render-page.mjs: when the root theme exports no colorModes, the export reads the page and text colors (--color-background-body, --color-background-surface, --color-text-primary) that the theme's own compiled stylesheet sets on its root; that stylesheet counts whether the page imports it directly or through an @import in its own CSS (followed with the same resolveImport the refusal pre-scan and the inliner use, and read inside the import's @media, supports() and layer() conditions through the inliner's own underImportConditions, so a theme imported for one scheme keeps both modes). A theme passed to Theme unbuilt injects its CSS only at run time, which the render does not read, so only what the page's own stylesheets set on that theme's root counts; the docs, the changeset and DEC-19 say so. A light page with dark text draws in light only. A dark page with light text draws in dark only (covered by the oneColorModeOf unit cases; the dark-only Gothic theme is decided by its own colorModes = ['dark'] export). A theme that sets neither (a fonts-only or accent-only theme), or sets a light-dark() color (a value for each mode) or one the color reader cannot fix (such as a var()), keeps both modes. Derived status colors that every built theme carries don't count. Any page or text color set under a light or dark condition anywhere in a stylesheet that names the theme (a prefers-color-scheme query, not forms included, or a data-theme rule, nested or in a selector list) keeps both modes, as before: the export never guesses one mode past such a rule. A media surface's own colors (data-astryx-media) don't count, while a component's light or dark block that only keeps out of media surfaces (:not(... [data-astryx-media] ...)) does. Only the root theme's own root rule (its attribute, or :scope in an @scope whose start is exactly that attribute) sets the root's colors; a nested rule, a part, or a to (...) limit does not. Attribute selectors read the same however they are quoted, and a flagged one ([data-theme="dark" i]) by its flag, and a .light/.dark class counts as a light or dark condition. A translucent page color keeps both modes (the guide says an opaque page color); text is light or dark by its own color, whatever its alpha. The one-mode rule adds no specificity, so a page's own unlayered html background still wins (one inside @layer does not). The theme module is looked up from the theme's stylesheet: the module with the stylesheet's name beside it, then the installed package's ./built entry, then its own entry (by the package name the page imports the stylesheet as, resolved from the importing file as theme add finds packages, so a linked package and a nested dist/package.json don't hide it; a stylesheet the page reaches by path uses the installed package folder after the last node_modules). The theme editor's markup-only pages keep both schemes, since the editor shows each mode itself. A one-mode page gets :where(:root){color-scheme:<mode>;background-color:var(--color-background-body)} and <meta name="color-scheme" content="<mode>">.
  • The export runs no theme module to decide, and a two-mode theme, or a page with no theme, is written byte for byte as before.

Evidence

  • Reproduction before the change: the Chromium case, with the base code, gives the light-only page color-scheme: light dark, the bug.
  • Result after the change: in Chromium with a dark color scheme, the light-only theme's page has scheme light, the theme's page color on <html>, and dark heading text on it.
  • A dark-only theme stays dark: the dark-only Gothic theme, built with astryx theme build, exports color-scheme: dark (through its colorModes export). In Chromium, Core's track color resolves to its dark value in both a dark and a light viewer.
  • Representative unchanged path: a two-mode theme stays light dark with a transparent <html>, and its file is unchanged.
  • In an 82-page phone and dark-mode set at 390 and 375 px, every page whose theme draws in both modes, or that has no theme, is byte-identical; the light-only cases stay light with the theme's page color in every view.
  • Regression tests: foundation/discovery/color-modes.test.mjs (the static reader, re-exports, a two-mode export), foundation/render/render.test.mjs (the decision: an export wins, a two-mode export keeps both even over a stylesheet with no dark value, light from the theme's own page and text colors, fonts-only and accent-only themes keep both, no theme), api/render/render.test.mjs (a light-only theme exports light with its page color; a colorModes export wins over the stylesheet, for one mode and for both; themes built with astryx theme build: light page colors export light only, and a fonts-only or accent-only theme keeps both modes; the two-mode control; the dark-only Gothic theme built with astryx theme build exports dark only), and .github/scripts/render-interaction-parity.browser.test.mjs (the Chromium cases: a light-only theme in a dark viewer, and the dark-only Gothic theme with Core's track color in a dark and a light viewer).

Scope

Components: cli export (foundation/render/render-page.mjs, foundation/discovery/color-modes.mjs, foundation/discovery/theme-imports.mjs), the shared color reader (foundation/color/css-color.mjs, foundation/runtime/word-table.mjs, foundation/runtime/css-tree.mjs header), foundation/discovery/module-exports.mjs and its users in the theme editor (they import css-color.mjs); records architecture:cli-surface (DEC-19) and spec:AST-050 (FR7)

  • One defect is restored.
  • Separable contradictory or unsettled tagalongs were removed or split.
  • No new public API, visual representation, default, or interaction model is hidden under the bug-fix label.
  • Public text and artifacts contain no internal Meta context.

Records

  • architecture:cli-surface DEC-19 states the export's one-mode rule as the code applies it: colorModes decides; without it, fixed root page and text colors that all read as one mode keep that mode, unless a stylesheet naming the theme sets a page or text color under a light or dark condition (a media surface's own colors aside); everything else keeps both schemes.
  • spec:AST-050 FR7: one sentence now scopes "a theme that exports none draws both" to an app and points to cli-surface DEC-19. Nothing else in FR7 changes.

Writing rubric results

  • R1 narration: none; DEC-19 and the FR7 sentence state what the export and an app do, in the present tense.
  • R2 research: none in the record; the phone-and-dark measurements stay in this description.
  • R3 evidence: none cites a pull request, issue or commit.
  • R4 rejected alternatives: two in DEC-19, on one Rejected: line.
  • R5 change references: none.
  • R6 open questions: none.
  • R7 project status: none.

Testing

  • Theme add and use, discovery, export and render suites: all pass at this head.
  • This head's own runs: the theme add, discovery, export and render suites, the Chromium cases, the published API type checks, check:knowledge, Prettier and ESLint on the changed files.
  • The full local CI half (lint, build, typecheck, full node and ui suites) passed at an earlier head of this change. Since that run, this head adds following @imports to the theme's stylesheet, the "built theme" wording, cli-surface DEC-19 and the AST-050 FR7 sentence, the .light/.dark class and i-flag conditions, the @scope start and text-alpha predicates, the media-surface :not(...) rule, the package lookup by the name the page imports the package as (so a linked package's colorModes is read), the export guide's wording, and their tests.
  • ASTRYX_RENDER_PARITY_BROWSER=1 pnpm exec vitest run .github/scripts/render-interaction-parity.browser.test.mjs -t "theme in a dark viewer" (Chromium, the light-only and dark-only cases and the two-mode control): passes.
  • eslint on the changed files.

preflight: pass ee95725

@vercel

vercel Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Nov 19, 2026 6:40pm UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 18, 2026
@astracat-bot

astracat-bot Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 19, 2026, 6:54 PM UTC

@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec e372e52

@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · 09be70c

Storybook · Sandbox · built from this PR's head

Package size: @astryxdesign/cli 5.50 MB packed (+3.1 kB); no new dependencies.

Not run on this PR: add ci:run-visual for Visual, ci:run-a11y for Accessibility, ci:run-rtl for RTL.

CI impact: 0 job-min per update · pool 0% · standard runners · 1 CI action or script file changed (not measured)
Before After Change
Job-minutes per PR update 172.6 172.6 0
Runner pool, runner-minutes a day 51,495 51,495 0 (0%)
Average concurrent jobs 35.8 35.8 0
Time to green (median → this run) 27.8 min — —
Runs a day 298 298 0

Not measured (the jobs that use these keep their recent minutes above): .github/scripts/render-interaction-parity.browser.test.mjs.

Assumptions: before is each job's average over the last 20 pull-request runs; after keeps that for unchanged jobs and uses this run's minutes for added or changed ones, weighted by how often each changed job ran in those runs; runs a day averages the seven whole days before today; time to green compares this run with the median of those runs that ran the same jobs.

Current run: CI concluded cancelled; parts of this report may be missing.


Generated by PR Enrichment workflow | View full report

@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec fe4b155

@astracat-bot astracat-bot 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.

Changes requested: the engineering owner's approval settles the export's one-scheme rule, but the stylesheet fallback misreads real themes in both directions and the render worker now runs files the page only imports as text.

  • The stylesheet fallback (render-page.mjs:1086-1091) forces light on pages whose theme sets no colours of its own, such as a fonts-only or accent-only theme that followed a dark viewer before, so the changeset's and description's "written as before" claims are false.
  • A light-only theme built with astryx theme build that sets a surface or card colour and exports no colorModes still exports light dark and stays black on the dark canvas, because the build adds derived light-dark() status roles, so narrow the title, changeset and guide to themes that export colorModes (or fix the rule) and add a test that exports a built theme.
  • rootThemeColorModes (page-worker.mjs:1503-1509) imports every local file beside an imported stylesheet, including files imported only as ?raw text, and the main module of any package whose stylesheet the page imports, so the export now executes code the page never runs.
  • render-page.mjs:1084-1085 re-implements the theme build's oneColorMode, and both files read the root theme name with a new regex beside rootThemeAttrs, so move the lookup into one shared helper and trust the worker's normalised value.
  • The description says a two-mode colorModes export keeps both modes, but the worker turns it into null (page-worker.mjs:1520) so the stylesheet rule decides, and the test at render.test.mjs:345 passes only because its stylesheet uses light-dark().
  • Miss: the worker reads colorModes by running theme modules, while builtColorMode in foundation/discovery/theme-imports.mjs already reads it without running anything for theme add and the theme preview, so call it with the root theme's module file, which also removes the execution above.
  • The description cites the CLI architecture record and the export guide for "a rendered file shows the page in any viewer as the app shows it", but neither says that (the guide said colours follow the viewer's setting), so cite the owner's decision on this pull request instead.
Claims and files checked

Review mode: incremental; reason: none

Claims:

  • Changeset: a page whose root theme draws in light only stays readable in a dark viewer: false for a built light-only theme with no colorModes (it still exports light dark); true with a one-mode colorModes export.
  • Changeset: before, the file declared both schemes, so a dark viewer showed its dark canvas behind dark text: verified on the base export.
  • Changeset and description: the modes come from the theme's colorModes export when it has one: verified for one mode; false for a two-mode export (page-worker.mjs:1520).
  • Changeset and description: otherwise from the built stylesheets, where no dark rule means light only: implemented as described (render-page.mjs:1070, :1086-1091), but built themes that set colours always carry derived light-dark() roles.
  • Changeset and description: a one-mode page declares only that scheme and paints the theme's page colour: verified (render-page.mjs:1101-1103, :1764, :1771, and in Chromium).
  • Changeset and description: a two-mode theme, or a page with no theme, is written as before, byte for byte: false for themes that set no colours; true for themes with a dark rule and pages with no theme.
  • Description: the file shows the page as the app shows it, per the CLI architecture record and the export guide: false; neither states it.
  • Description: the app shows a light-only theme in light whatever the system setting: true only when the app passes the theme's mode to Theme, which already exported light before this change.
  • Description: the theme module is looked up only beside a stylesheet the page imports: partly false; any local file in that folder is imported, text-only imports included.
  • Description: before the change the light-only page gets both schemes; after it, Chromium in dark shows light, the page colour and dark heading text: verified for the test fixture and for a colorModes theme; not for a built light-only theme without colorModes.
  • Description: a two-mode theme keeps light dark with a transparent root: verified for themes with a light-dark() value; false for themes that set no colours.
  • Description: in a phone and dark-mode page set, every page under a two-mode theme or no theme is byte-identical: contradicted for fonts-only and accent-only themes.
  • Description: the listed tests pass: verified at this head (four node suites, 376 tests; the Chromium case, 2 tests); the two-mode export case does not isolate the export.
  • Description: eslint passes on the changed files: verified (0 errors).
  • Description: one defect is restored and no default or visual change hides under the bug-fix label: false for two-mode themes that set no colours, whose exported scheme changes.
  • Description: public text holds no internal context: verified.

Files:

  • .changeset/export-light-only-theme.md: two false claims (above).
  • .github/scripts/render-interaction-parity.browser.test.mjs: passes, but only with hand-written theme stylesheets the build never writes.
  • packages/cli/api/render/render.test.mjs: passes, with hand-written theme stylesheets.
  • packages/cli/assets/docs/tree/export-pages.doc.mjs: repeats the stylesheet rule that misreads fonts-only and built light-only themes.
  • packages/cli/foundation/doc-compiler/doc-loads.test.mjs: clear.
  • packages/cli/foundation/render/page-worker.mjs: executes text-only imports; drops a two-mode export; duplicates builtColorMode and the root-theme lookup.
  • packages/cli/foundation/render/render-page.mjs: forces light on two-mode pages; misses built light-only themes; copied predicate.
  • packages/cli/foundation/render/render.test.mjs: the two-mode export case does not test what it claims.

Automated review (maintainer link)

@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 09be70c

@astracat-bot astracat-bot 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.

Changes requested: light-only themes now stay light in a dark viewer and two-mode themes are unchanged, but the stylesheet inference also turns the dark-only Gothic theme light, and the description no longer matches the code.

  • oneColorModeOf (render-page.mjs:1130-1131) calls any theme with plain page colours light, so pages under the published dark-only Gothic theme are now written color-scheme: light, and in a dark viewer its Slider and Spinner track turns #CCD3DB on the dark card (fill against track 5.68:1 to 1.32:1); infer light only from light page colours, keep Gothic dark or two-mode, and add a test that exports the Gothic template.
  • The export guide's new sentence "A page whose root theme draws in one mode keeps it" (export-pages.doc.mjs:60) is false for Gothic until the inference is fixed.
  • The description still says page-worker.mjs reads colorModes with the theme build's oneColorMode and that any of four dark markers decides, while this head changes render-page.mjs, color-modes.mjs and theme-imports.mjs and reads only three page-colour tokens, so update its restoration and Scope sections to the code.
  • The description cites the CLI architecture record and the export guide for "a rendered file shows the page in any viewer as the app shows it", but neither says that, so cite the engineering owner's decision on this pull request instead.

The six issues from the previous review (fonts-only themes forced light, built light-only themes missed, executed text imports, the copied mode predicate, two-mode colorModes ignored, and the duplicate colorModes reader) are fixed.

Claims and files checked

Review mode: incremental; reason: none

Claims:

  • Changeset: a page whose root theme draws in light only stays readable in a dark viewer: verified for a light-only theme built with astryx theme build and in the Chromium case.
  • Changeset: before, the file declared both schemes, so a dark viewer showed its dark canvas behind dark text: verified on the base export.
  • Changeset: the export reads the theme module's colorModes without running it: verified (color-modes.mjs reads the file text; its test throws if the module runs).
  • Changeset: otherwise a theme that sets its page or text colours with no dark value draws in light only: implemented as written (render-page.mjs:1084-1131), but false for the dark-only Gothic theme, which is written light.
  • Changeset: a fonts-only or accent-only theme keeps both modes: verified (built fonts-only page byte-identical to the base; unit cases).
  • Changeset and description: a one-mode page declares only that scheme and paints the theme's page colour: verified (render-page.mjs:1211-1213, :1879, :1886, and in Chromium).
  • Changeset and description: a page under a two-mode theme, or with no theme, is written as before, byte for byte: verified for the six two-mode published themes and a fonts-only theme.
  • Description: the light-only page turns black-on-black in a dark viewer on the base: verified.
  • Description: the fix uses colorModes, otherwise no dark rule in the theme's stylesheets means light only: partly false; only the three page-colour tokens count.
  • Description: a rendered file shows the page as the app shows it, per the CLI architecture record and the export guide: false; neither says it.
  • Description: the app shows a light-only theme in light whatever the system setting: true only when the app passes the theme's mode to Theme.
  • Description: page-worker.mjs finds the theme module and reads colorModes with the theme build's oneColorMode: false; page-worker.mjs is unchanged and render-page.mjs:1144 reads it with declaredColorModes.
  • Description: oneColorModeOf takes a one-mode export, else four dark markers decide: partly false; the markers count only around page-colour declarations.
  • Description: Chromium before and after results, and the unchanged two-mode path: verified.
  • Description: an 82-page set is byte-identical for two-mode and no-theme pages: not rerun in full; consistent with the nine themes exported here.
  • Description: the listed regression tests exist and pass, and eslint passes: verified (383 node tests, 2 Chromium tests, 0 lint errors).
  • Description: the Scope lists page-worker.mjs and render-page.mjs: incomplete; color-modes.mjs and theme-imports.mjs change, page-worker.mjs does not.
  • Description: one defect is restored and no default or visual change hides under the fix: false for Gothic, whose written scheme changes.
  • Description: public text holds no internal context: verified.

Files:

  • .changeset/export-light-only-theme.md: its light-only rule reads the dark-only Gothic theme as light.
  • .github/scripts/render-interaction-parity.browser.test.mjs: clear.
  • packages/cli/api/render/render.test.mjs: clear; it has no dark-only theme case.
  • packages/cli/assets/docs/tree/export-pages.doc.mjs: "keeps it" is false for Gothic; "page and text colors" differs from the code's "page or text".
  • packages/cli/foundation/discovery/color-modes.mjs: clear.
  • packages/cli/foundation/discovery/color-modes.test.mjs: clear.
  • packages/cli/foundation/discovery/theme-imports.mjs: clear.
  • packages/cli/foundation/render/render-page.mjs: dark-only themes written light (:1130-1131).
  • packages/cli/foundation/render/render.test.mjs: clear; it has no case for dark plain page colours.

Automated review (maintainer link)

@josephfarina
josephfarina force-pushed the josephfarina/rl-export-light-only branch from 09be70c to 552c2c3 Compare November 19, 2026 11:34
@josephfarina josephfarina changed the title fix(cli): export keeps a light-only theme light in a dark viewer fix(cli): export keeps a built one-mode theme in its mode in any viewer Nov 19, 2026
@josephfarina
josephfarina force-pushed the josephfarina/rl-export-light-only branch from 552c2c3 to d1d014b Compare November 19, 2026 11:42
@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec d1d014b

@astracat-bot astracat-bot 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.

Changes requested: the export now keeps a theme that draws in one mode in that mode, and pages under two-mode themes are written byte for byte as before, but one claim in the description is false.

  • Miss: the description says the file shows the page "as the app shows it", but a theme with no colorModes export gets no mode from theme add, so in an app its Theme follows the viewer while the file now keeps one mode; reword it to say the file keeps the theme's one mode, read from colorModes or inferred from its root page and text colors, and that for a theme without colorModes this differs from the app.

CI has not run at this head because its commit message ends with [skip ci], so the required checks still need a run before merge. Non-blocking: a dark rule written with an attribute flag ([data-theme="dark" i]) or a class selector is not read as a mode condition, so such a theme is written in the mode its root colors give.

Claims and files checked

Review mode: full; reason: rebase

Claims (changeset):

  • A page whose root theme draws in one mode stays readable in a viewer of the other scheme: verified (exports on both trees and Chromium).
  • Before, the file always declared both schemes: verified (the base scheme rules and meta tag).
  • The theme module's colorModes decides when present, read without running it: verified (built and packaged modules; the re-export test that throws if run).
  • Otherwise a light page with dark text is light only and a dark page with light text is dark only: verified (render tests, exports).
  • Any color form the theme editor reads counts: verified (named, hsl(), oklch() cases).
  • Fonts-only, accent-only, light-dark(), unreadable and one-scheme colors keep both modes: verified (render tests).
  • A one-mode page declares only that scheme and paints the theme's page color: verified.
  • Two-mode and no-theme pages are written as before: verified (six two-mode templates byte-identical; two-mode control).

Claims (description):

  • The base file declared both schemes for every page: verified.
  • colorModes first, else the root's page and text colors from the page's stylesheets: verified.
  • One shared static colorModes reader for theme add, the preview and the export, keeping two modes as its own value: verified.
  • The export, render() and guide docs describe the rule: verified.
  • resolvePackageModule is exported for the module lookup: verified.
  • The color reader moves unchanged and its users import it from the new module: verified (moved bodies identical; theme editor and palette tests pass).
  • The listed rules (three tokens, derived status colors ignored, one-scheme conditions, root rule only, quoting, translucent page colors, zero specificity, lookup order, editor pages keep both): verified, except attribute flags (non-blocking).
  • The export runs no theme module: verified.
  • The Chromium cases (light-only in a dark viewer, Gothic in both viewers, the two-mode control): verified (they pass).
  • The file shows the page "as the app shows it": false for themes without colorModes.
  • The listed regression tests exist and pass: verified.
  • Theme add, theme build, discovery, export and render suites pass at this head: verified.
  • The 82-page phone set, the earlier heads' CI and the squash statement: not checkable from this pull request's history.

Files:

  • .changeset/export-light-only-theme.md: clear.
  • .github/scripts/render-interaction-parity.browser.test.mjs: clear.
  • packages/cli/api/render/render.doc.mjs: clear.
  • packages/cli/api/render/render.test.mjs: clear.
  • packages/cli/api/theme-edit/_color.mjs: clear.
  • packages/cli/api/theme-edit/_css.mjs: clear.
  • packages/cli/api/theme-edit/_tables.mjs: clear.
  • packages/cli/api/theme/palette/generate/color.mjs: clear.
  • packages/cli/assets/docs/tree/export-pages.doc.mjs: clear.
  • packages/cli/assets/docs/tree/share-a-page.doc.mjs: clear.
  • packages/cli/clients/cli/commands/experimental-export.doc.mjs: clear.
  • packages/cli/foundation/color/css-color.mjs: clear.
  • packages/cli/foundation/discovery/color-modes.mjs: clear.
  • packages/cli/foundation/discovery/color-modes.test.mjs: clear.
  • packages/cli/foundation/discovery/module-exports.mjs: clear.
  • packages/cli/foundation/discovery/theme-imports.mjs: clear.
  • packages/cli/foundation/render/render-page.mjs: non-blocking note on attribute flags and class-based dark rules.
  • packages/cli/foundation/render/render.test.mjs: clear.
  • packages/cli/foundation/runtime/css-tree.mjs: clear.
  • packages/cli/foundation/runtime/word-table.mjs: clear.

Automated review (maintainer link)

@josephfarina
josephfarina force-pushed the josephfarina/rl-export-light-only branch from d1d014b to 76bca97 Compare November 19, 2026 12:58
@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 19, 2026

@astracat-bot astracat-bot 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.

Approval waits on an engineering owner's decision on the two record changes this head adds; the code change itself has no blocking finding.

  • This head adds architecture:cli-surface DEC-19 and rewords the last sentence of spec:AST-050 FR7, and neither has spec-owner approval yet: an engineering owner approves both as written by commenting /approve-spec 76bca97d0aba31f2fdae5346d97a45812ee751fe, or asks for changes, and the author may do so as an engineering owner.
  • Miss (optional wording fix): the export guide (export-pages.doc.mjs) could say that a theme whose colorModes lists both modes always follows the viewer, even when its root colors read as one mode.

In Chromium, exports under a light-only and a dark-only theme now keep their mode in a viewer of the other scheme, and pages under two-mode themes are byte-identical to before. CI has not run on this head yet, because its commit message carries [skip ci].

Claims and files checked

Review mode: full; reason: rebase

  • Claim: a page whose root theme draws in one mode stays readable in a viewer of the other scheme: verified in Chromium, light-only theme in a dark viewer and the Gothic template in a light viewer.
  • Claim: before, the file declared both schemes, so a dark viewer showed its dark canvas behind a light-only theme's dark text: verified on the base export.
  • Claim: colorModes is read without running the module, following re-exports, and a two-mode export keeps both modes: verified by the color-modes and render tests.
  • Claim: without colorModes, the root page and text colors decide by lightness, and fonts-only, accent-only, light-dark(), var(), translucent or conditional colors keep both modes: verified by the unit and render tests and by exports in both trees.
  • Claim: a one-mode page declares one scheme and paints the theme's page color on the document: verified (render-page.mjs:1445, :2252, :2260).
  • Claim: a page under a two-mode theme or no theme is written byte for byte as before: verified for the six two-mode template themes and two hand-written themes against the base.
  • Claim: for a theme without colorModes the file keeps one mode while an app follows the viewer: verified against the app-themes spec (FR5) and the Theme component's system mode.
  • Claim: the theme editor's color reader and the luminance formula move unchanged, and the theme editor and palette generator import them: verified line by line.
  • Claim: resolvePackageModule is exported, and theme add and the theme preview use the shared colorModes reader: verified.
  • Claim: the listed regression tests exist and pass at this head: verified (the render, discovery, theme editor and palette suites pass); the earlier head's CI run and the 82-page phone set were not reproduced.
  • Claim: DEC-19 states the rule as the code applies it, and FR7 changes one sentence: verified.
  • Claim: the title's scope (a built one-mode theme keeps its mode in any viewer): verified.
  • Files: all 22 changed files visited; the two record files wait on owner approval, export-pages.doc.mjs carries the optional wording note, and the other 19 are clear.

Automated review (maintainer link)

@josephfarina
josephfarina force-pushed the josephfarina/rl-export-light-only branch from 76bca97 to 8d5a88d Compare November 19, 2026 13:59
@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 8d5a88d

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Nov 19, 2026
@josephfarina
josephfarina force-pushed the josephfarina/rl-export-light-only branch from 8d5a88d to 3fe66d2 Compare November 19, 2026 14:49
@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 3fe66d2

@astracat-bot astracat-bot 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.

Approved pending CI: CI has not run on this head yet. The head commit's message carries [skip ci], so the required checks need a run before merge.

No blocking findings; an engineering owner approved the two record changes for this head. Two small, non-blocking suggestions sit inline: two file headers say the palette generator uses the new color reader, which it no longer does, and the export guide's colorModes sentence reads as if only a one-mode export stops the color inference.

Claims and files checked

Review mode: full; reason: rebase

  • Claims
    • A one-mode root theme's exported page stays readable in a viewer of the other scheme: verified (Chromium frames in a dark viewer; the light-only case in api/render/render.test.mjs).
    • Before, the file always declared both schemes: verified (the base writes light dark for the same page).
    • colorModes is read without running the module, following re-exports, and a two-mode export keeps its own value: verified (foundation/discovery/color-modes.mjs and its tests).
    • Without colorModes, agreeing opaque root page and text colors decide, in any CSS color form the theme editor reads: verified (render-page.mjs:1311-1375 and the unit cases).
    • Fonts-only or accent-only themes, light-dark(), unreadable or translucent page colors, and page or text colors under a light or dark condition keep both modes, and media-surface colors do not count: verified (unit cases).
    • Only the root rule, or :scope in an @scope that starts there, sets the root colors, however attributes are quoted or flagged, with .light/.dark classes read as conditions: verified (unit cases).
    • A one-mode page declares only that scheme and paints the theme's page color at zero specificity: verified (render-page.mjs:1456-1457, frames).
    • Two-mode and theme-less pages, and the theme editor's markup-only previews, are written as before: verified (the scheme strings are unchanged when no mode is found; tests).
    • theme add and the theme preview read through the same reader and still carry only one mode: verified (theme-imports.mjs:277-279, _preview.mjs:2508, tests).
    • The theme module is found beside the stylesheet, then through the package's ./built entry, then its own entry, by the imported package name, linked and nested-dist packages included: verified (render-page.mjs:1395-1446, tests).
    • The dark-only Gothic theme exports dark: verified (the built-Gothic test).
    • The color reader moved unchanged, its two formula copies pinned to the generated palette engine: verified (line comparison; css-color.test.mjs).
    • foundation/ never imports from api/: verified (no non-test import at this head).
    • Two-mode and theme-less pages are byte-identical across an 82-page set: not reproduced; the code path writes the same bytes for them.
    • The two record changes state the rule as coded: verified (DEC-19 and the FR7 sentence against render-page.mjs).
    • The changed suites pass at this head: verified for the suites run here; the browser parity cases were not run.
  • Files
    • .changeset/export-light-only-theme.md: clear.
    • .github/scripts/render-interaction-parity.browser.test.mjs: clear.
    • docs/architecture/cli-surface.md: clear.
    • docs/specs/AST-050-app-themes/spec.md: clear.
    • packages/cli/api/render/render.doc.mjs: clear.
    • packages/cli/api/render/render.test.mjs: clear.
    • packages/cli/api/theme-edit/_color.mjs: clear.
    • packages/cli/api/theme-edit/_css.mjs: clear.
    • packages/cli/api/theme-edit/_tables.mjs: clear.
    • packages/cli/assets/docs/tree/export-pages.doc.mjs: non-blocking wording suggestion.
    • packages/cli/assets/docs/tree/share-a-page.doc.mjs: clear.
    • packages/cli/clients/cli/commands/experimental-export.doc.mjs: clear.
    • packages/cli/foundation/color/css-color.mjs: non-blocking header suggestion.
    • packages/cli/foundation/color/css-color.test.mjs: clear.
    • packages/cli/foundation/discovery/color-modes.mjs: clear.
    • packages/cli/foundation/discovery/color-modes.test.mjs: clear.
    • packages/cli/foundation/discovery/module-exports.mjs: clear.
    • packages/cli/foundation/discovery/theme-imports.mjs: clear.
    • packages/cli/foundation/render/render-page.mjs: clear.
    • packages/cli/foundation/render/render.test.mjs: clear.
    • packages/cli/foundation/runtime/css-tree.mjs: non-blocking header suggestion.
    • packages/cli/foundation/runtime/word-table.mjs: clear.

Automated review (maintainer link)

@josephfarina
josephfarina force-pushed the josephfarina/rl-export-light-only branch from 3fe66d2 to 7ee89de Compare November 19, 2026 15:24
@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 19, 2026
@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 7ee89de

@astracat-bot astracat-bot 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.

Changes requested: a built light-only theme whose stylesheet the page imports now stays light in a dark viewer, and the two record changes carry an engineering owner's approval for this head, but two gaps remain on lines unchanged since the earlier approval.

  • Miss: the mode read uses the raw text of the stylesheets the page imports (packages/cli/foundation/render/render-page.mjs:2255), so the same built theme reached through @import './retro.css' in the page's CSS is written color-scheme: light dark and shows black on black in a dark viewer, which DEC-19 does not allow; follow each @import as expandImports does and add a test.
  • Miss: the changeset (.changeset/export-light-only-theme.md:5), the export guide, the share-a-page guide, the command doc and the render() doc promise that any one-mode theme keeps its mode, but a theme passed to Theme unbuilt injects its CSS only at runtime and is still exported light dark; name built themes in those sentences or read unbuilt themes too.

The two earlier non-blocking suggestions still apply (the palette-generator lines in two file headers, and the export guide's two-mode colorModes wording). CI has not run on this head yet because its commit message carries [skip ci].

Claims and files checked

Review mode: full; reason: rebase

  • Claims
    • A one-mode root theme's exported page stays readable in a viewer of the other scheme: verified for a built theme whose stylesheet the page imports directly (Chromium frames, the light-only test, the browser parity cases); false for a stylesheet reached through @import and for an unbuilt theme (blocking findings).
    • Before, the file always declared both schemes: verified (the base writes light dark for the same page).
    • colorModes is read without running the module, following re-exports, and a two-mode export keeps both: verified (foundation/discovery/color-modes.mjs and its tests).
    • Without colorModes, agreeing opaque root page and text colors decide, in any CSS color form the theme editor reads: verified for stylesheets the page imports directly; false through @import (first blocking finding).
    • Fonts-only or accent-only themes, light-dark(), unreadable or translucent page colors, and page or text colors under a light or dark condition keep both modes; media-surface colors do not count: verified (unit cases).
    • Only the root rule, or :scope in an @scope that starts there, sets the root colors, however attributes are quoted or flagged, with .light/.dark classes read as conditions: verified (unit cases).
    • A one-mode page declares only that scheme and paints the theme's page color at zero specificity: verified (render-page.mjs:1505-1506, :2370, :2378, frames).
    • Two-mode and theme-less pages, and the theme editor's markup-only previews, are written as before: verified (the scheme strings are unchanged when no mode is found; tests).
    • theme add and the theme preview read through the same reader and still carry only one mode: verified (theme-imports.mjs:277-280, tests).
    • The theme module is found beside the stylesheet, then through the package's ./built entry, then its own entry, by the imported package name, linked and nested-dist packages included: verified (render-page.mjs:1444-1495, tests).
    • The dark-only Gothic theme exports dark: verified (the built-Gothic test, and a build of the published theme).
    • The color reader moved unchanged, its two formula copies pinned to the generated palette engine: verified (line comparison, css-color.test.mjs).
    • foundation/ never imports from api/: verified (no non-test import).
    • resolvePackageModule resolves the exports map, else module, main or the index file: verified (module-exports.mjs:420-460).
    • The two record changes state the rule as the code applies it: false for a stylesheet reached through @import (first blocking finding).
    • Two-mode and theme-less pages are byte-identical across an 82-page set: not reproduced; the code path writes the same bytes for them.
    • The changed suites and the Chromium cases pass: verified for the suites run here; three older export tests fail the same way on the base.
  • Files
    • .changeset/export-light-only-theme.md: blocking (unbuilt themes).
    • .github/scripts/render-interaction-parity.browser.test.mjs: clear.
    • docs/architecture/cli-surface.md: clear.
    • docs/specs/AST-050-app-themes/spec.md: clear.
    • packages/cli/api/render/render.doc.mjs: blocking (unbuilt themes).
    • packages/cli/api/render/render.test.mjs: clear; needs an @import case.
    • packages/cli/api/theme-edit/_color.mjs: clear.
    • packages/cli/api/theme-edit/_css.mjs: clear.
    • packages/cli/api/theme-edit/_tables.mjs: clear.
    • packages/cli/assets/docs/tree/export-pages.doc.mjs: blocking (unbuilt themes); non-blocking two-mode wording.
    • packages/cli/assets/docs/tree/share-a-page.doc.mjs: blocking (unbuilt themes).
    • packages/cli/clients/cli/commands/experimental-export.doc.mjs: blocking (unbuilt themes).
    • packages/cli/foundation/color/css-color.mjs: non-blocking header suggestion.
    • packages/cli/foundation/color/css-color.test.mjs: clear.
    • packages/cli/foundation/discovery/color-modes.mjs: clear.
    • packages/cli/foundation/discovery/color-modes.test.mjs: clear.
    • packages/cli/foundation/discovery/module-exports.mjs: clear.
    • packages/cli/foundation/discovery/theme-imports.mjs: clear.
    • packages/cli/foundation/render/render-page.mjs: blocking (@import).
    • packages/cli/foundation/render/render.test.mjs: clear.
    • packages/cli/foundation/runtime/css-tree.mjs: non-blocking header suggestion.
    • packages/cli/foundation/runtime/word-table.mjs: clear.

Automated review (maintainer link)

Comment thread .changeset/export-light-only-theme.md Resolved
A page whose root theme draws in one mode is exported in that mode: the
theme's colorModes export decides, read without running the module, and
otherwise the opaque page and text colors the theme's root sets decide
by lightness. Any page or text color set under a light or dark
condition keeps both modes, as before. The theme editor's color reader
moves to foundation/color so the export reads colors the same way.

[skip ci]
@josephfarina
josephfarina force-pushed the josephfarina/rl-export-light-only branch from 7ee89de to ee95725 Compare November 19, 2026 18:22
@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 19, 2026
@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec ee95725

@astracat-bot astracat-bot 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.

Approved pending CI: CI has not run on this head yet, because its commit message carries [skip ci].

astryx experimental export now keeps a built one-mode theme in its mode in any viewer, including a theme stylesheet the page reaches through @import, and the two record changes carry an engineering owner's approval for this head. The earlier @import and unbuilt-theme findings are fixed, as are the earlier header and export-guide suggestions.

  • Non-blocking: the changeset's first sentence still reads as covering every one-mode theme; adding "built" ("a page whose root theme is built and draws in one mode stays readable in a viewer of the other scheme") would match the title and the docs.
Claims and files checked

Review mode: full; reason: rebase

  • Claims
    • A page whose root theme draws in one mode stays readable in a viewer of the other scheme: verified for built themes imported directly or through @import (tests, Chromium frames); the changeset's first sentence also reads as covering unbuilt themes, which the same entry then excludes (non-blocking wording).
    • Before, the file always declared both schemes: verified (the base writes light dark for the same pages).
    • colorModes is read without running the module, following re-exports, and a two-mode export keeps both: verified (color-modes.mjs, its tests).
    • Without colorModes, agreeing opaque root page and text colors decide by lightness, in any CSS color form the theme editor reads: verified (unit cases for hex, named, rgb(), hsl(), oklch()).
    • A theme stylesheet reached through @import in the page's CSS counts, with the inliner's resolution and conditions, and one imported for a single scheme keeps both: verified (three export tests).
    • Fonts-only and accent-only themes, light-dark(), unreadable or translucent page colors, and page or text colors under a light or dark condition keep both; media-surface colors and the derived status colors built themes carry do not count, and text counts by its own color whatever its alpha: verified (unit cases, the built-theme export test).
    • Only the root rule, or :scope in an @scope that starts there, sets the root colors, however attributes are quoted or flagged, with .light/.dark classes read as conditions: verified (unit cases).
    • A theme passed to Theme unbuilt counts only by what the page's own stylesheets set on its root: verified (the mode read uses only stylesheet text).
    • A one-mode page declares only that scheme and paints the theme's page color with no added specificity, so a page's own unlayered html background still wins: verified (render-page.mjs:1581, :2465, :2473, frames).
    • Two-mode and theme-less pages, and the theme editor's previews, are written as before: verified (exact two-scheme string test, markup-only test).
    • theme add and the theme preview use the same reader and still carry only one mode: verified (theme-imports.mjs:277, tests).
    • The theme module is found beside the stylesheet, then through the package's ./built entry, then its own entry, linked and nested-dist packages included: verified (render-page.mjs:1520, tests).
    • The dark-only Gothic theme exports dark: verified (built-Gothic export test).
    • The color reader moved unchanged, with its two formula copies pinned to the generated palette engine: verified (line comparison, css-color.test.mjs).
    • foundation/ code never imports from api/: verified for non-test code; css-color.test.mjs imports the palette engine only to pin the copies.
    • resolvePackageModule resolves the exports map, else module, main or the index file: verified (existing body, now exported).
    • The two record changes state the rule as the code applies it: verified.
    • Two-mode and theme-less pages are byte-identical across an 82-page set: not reproduced; the code writes the base's bytes when no mode is found.
    • The changed suites, ESLint and the knowledge check pass at this head: verified for the suites, ESLint and the knowledge check run here; the Chromium parity cases run only in CI, which has not run at this head.
    • The full local CI half passed at an earlier head: not checkable at this head and not relied on.
  • Files
    • .changeset/export-light-only-theme.md: non-blocking wording suggestion.
    • .github/scripts/render-interaction-parity.browser.test.mjs: clear.
    • docs/architecture/cli-surface.md: clear.
    • docs/specs/AST-050-app-themes/spec.md: clear.
    • packages/cli/api/render/render.doc.mjs: clear.
    • packages/cli/api/render/render.test.mjs: clear.
    • packages/cli/api/theme-edit/_color.mjs: clear.
    • packages/cli/api/theme-edit/_css.mjs: clear.
    • packages/cli/api/theme-edit/_tables.mjs: clear.
    • packages/cli/assets/docs/tree/export-pages.doc.mjs: clear.
    • packages/cli/assets/docs/tree/share-a-page.doc.mjs: clear.
    • packages/cli/clients/cli/commands/experimental-export.doc.mjs: clear.
    • packages/cli/foundation/color/css-color.mjs: clear.
    • packages/cli/foundation/color/css-color.test.mjs: clear.
    • packages/cli/foundation/discovery/color-modes.mjs: clear.
    • packages/cli/foundation/discovery/color-modes.test.mjs: clear.
    • packages/cli/foundation/discovery/module-exports.mjs: clear.
    • packages/cli/foundation/discovery/theme-imports.mjs: clear.
    • packages/cli/foundation/render/render-page.mjs: clear.
    • packages/cli/foundation/render/render.test.mjs: clear.
    • packages/cli/foundation/runtime/css-tree.mjs: clear.
    • packages/cli/foundation/runtime/word-table.mjs: clear.

Automated review (maintainer link)

'@astryxdesign/cli': patch
---

[experimental] `astryx experimental export`: a page whose root theme draws in one mode stays readable in a viewer of the other scheme. Before, the file declared both color schemes, so a dark viewer showed its dark canvas behind a light-only theme's dark text. The export reads the theme module's `colorModes` export when it has one, without running the module. Otherwise it reads the page or text colors the theme's compiled stylesheet, which the page imports (directly or through an `@import` in its own CSS), sets on its root: a light page with dark text draws in light only, and a dark page with light text in dark only. Any color the theme editor reads counts (hex, a named color, `rgb()`, `hsl()`, `oklch()` and the other CSS color forms). A theme that sets neither (a fonts-only or accent-only theme), sets a `light-dark()` color (a value for each mode), sets one the export cannot fix (such as a `var()`), or sets any page or text color under a light or dark condition keeps both modes, as before. A one-mode page declares only that scheme and paints the theme's own page color on the document. For a theme passed to `Theme` unbuilt, whose CSS is injected only at run time, only what the page's own stylesheets set on that theme's root counts. A page whose theme draws in both modes, or that has no theme, is written as before.

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.

Non-blocking: this first sentence reads as covering a theme passed to Theme unbuilt, which the same entry later excludes. Naming built themes here, as the title does, says it once:

[experimental] `astryx experimental export`: a page whose root theme is built and draws in one mode stays readable in a viewer of the other scheme.

josephfarina added a commit that referenced this pull request Nov 19, 2026
- #12843 feat(Table): column headings follow the Table's textOverflow
  Author: @josephfarina
- #12924 docs(Table): how long tokens wrap in a data-driven table
  Author: @josephfarina
- #12683 fix(cli): export keeps a built one-mode theme in its mode in any viewer
  Author: @josephfarina
@josephfarina

Copy link
Copy Markdown
Contributor Author

Landed in #12973.

@github-actions
github-actions Bot deleted the josephfarina/rl-export-light-only branch November 20, 2026 06:06

This branch was successfully deployed

1 active deployment
Preview — ee95725b Deployed Nov 19, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant