Skip to content

feat(themes): add Glass, a dark theme for data-dense apps - #12243

Closed
beribener wants to merge 1 commit into
mainfrom
beribener/theme-glass
Closed

beribener wants to merge 1 commit into
mainfrom
beribener/theme-glass

Conversation

@beribener

@beribener beribener commented Nov 17, 2026 •

Copy link
Copy Markdown

Closes #12240

User need

Teams that build dashboards and other data-dense tools with Astryx want a dark theme made for that job. Every built-in theme today is either general-purpose (Neutral, Stone) or editorial (Gothic, Y2K, Butter). None gives a dashboard what it needs:

  • a dark canvas that reads well for long sessions,
  • cards that separate tiles from the page without heavy borders, and
  • a way to give one card a color so that everything inside it (chart series, progress bars, links, focus rings) follows that color with no per-page styling.

Builders get this today only by writing their own theme or by styling each card by hand. Styling by hand breaks theme portability, because the page then names raw colors. Glass is a built-in theme for this case. Pages name only Card variants and tokens, so they render in every other theme too.

Problem and solution fit

  • Primary: a new theme package, @astryxdesign/theme-glass, in packages/themes/glass.
    • A dark-only navy canvas. Every color token whose Core default differs by mode is set, so the theme renders the same in light and dark mode, the same way Gothic does.
    • Glass cards: a cool tint from the top-left corner, a translucent edge, a light top edge, and 16px padding.
    • <Card variant="<hue>"> (blue, cyan, gray, green, orange, pink, purple, red, teal, yellow) tints the card, gives it a hued edge, and sets --color-accent, --color-text-accent, and --color-icon-accent to the hue for its subtree.
    • Soft purple and cyan glows on the app shell.
    • Accent #6ea8ff, container radius 1.25rem, and categorical data colors that match the card hues.
  • Supporting:
    • The palette follows the repo's pattern: palette.config.json (astryx-oklch-v2, dark-only, exact anchors), the generated ramps and receipt, the selected palette refs, and the generate:/check:glass-palette-refs scripts.
    • glass.spec.md, a draft theme record (theme:glass).
    • The theme test: contrast for text, accent, focus ring, control edges, and borders on every surface and every hue, a light/dark parity test, and a palette-only test.
    • A Changeset for the new package and the CLI.
    • Registrations, mirroring Gothic and Butter: the themes README table, root README, packages/README.md, CONTRIBUTING (the Storybook theme list), docs/themes/README.md, Storybook (main.ts, preview.tsx), the sandbox (provider, CSS, build deps, a Glass palette page), the docsite dependency list and its CI build step, the Changesets fixed group, root build/check:repo, the CLI theme bundle, the discover list and goldens, the generated Swift theme and its test lists, and the shared first-party contrast tests (scripts/lib/theme-contrast.mjs and the five tests that list themes).

No other behavior changes.

Current specification

  • Themes are a safe zone in the Contributing wiki. This is a theme only: it changes no Core component, prop, or export.
  • architecture:theme-authoring-contract, architecture:theme-tokens, and architecture:theme-compilation own the token vocabulary, defineTheme, and the theme CSS. Glass uses existing tokens and component targets only.
  • spec:AST-066 lets a concrete theme author a sparse set of data tokens. Glass authors the categorical hues, --color-data-neutral, and the data grays.
  • theme:glass (draft, in this PR) records Glass's own mappings and its measured contrast. It needs approval from an engineering or design owner (.github/ENGOWNERS / .github/DESIGNOWNERS). The record and the one-line change to packages/native/specs/swift/library/theme-generator.md are owner-gated, so this PR waits on that approval.

Public delta and caller burden

  • New package: @astryxdesign/theme-glass, with the same export shape as the other themes: . (source), ./built, ./theme.css, and ./fonts.css. It exports glassTheme and glassIconRegistry. The generated palette stays private, like Gothic's.
  • CLI: astryx theme add glass, theme eject glass, and astryx discover list Glass, because the bundle and the discover list are generated from packages/themes.
  • Native: Theme.glass is generated in packages/native/apple.
  • No change for existing callers. Nothing in Core or the other themes changes.

Use:

import {Theme} from '@astryxdesign/core/theme';
import {glassTheme} from '@astryxdesign/theme-glass/built';
import '@astryxdesign/theme-glass/theme.css';

<Theme theme={glassTheme} mode="dark">
  <Card variant="purple">…</Card>
</Theme>;

The caller makes two decisions. They pass mode="dark" for native browser chrome, as the Gothic README already advises. They also load Figtree, or the system font is used.

Design and alternatives

  • Standalone, no extends. No built-in theme extends another, and Gothic's record says it "does not extend another published package theme". Glass carries the Neutral values it shares (typography, motion, radius steps, icons) in its own source. An extends: neutralTheme would let Neutral's mode-dependent values leak into Glass's single mode.
  • Tokens and component targets only. Glass sets no cascade layers and no raw selectors outside the component targets.
  • Shadow rims are full inset rings (inset 0 0 0 1px). Native platforms draw only inset rings, so a top-edge-only inset would make the Swift generator warn and fall back to Core's shadows. The brighter top edge stays on cards, through the card target.
  • Questions for maintainers. Each one could read as token misuse. Each is also recorded as an open question or decision in glass.spec.md.
    1. A hued card re-points the accent (OQ2, DEC-3). card variant:<hue> sets --color-accent, --color-text-accent, and --color-icon-accent for the card's subtree. That makes the charts, progress bars, links, and focus rings inside the card follow the hue. Gothic's card variants already set --color-text-primary the same way, but the accent is a stronger intent token. If this is not allowed, the fallback is a hued surface that keeps the page accent.
    2. Control edges through three targets (OQ3, DEC-4). Glass's global --color-border-emphasized is a light 30% edge, which measures 1.9:1. field, checkbox-indicator, and radio-indicator raise it to 60% for their subtree, so every field shell, checkbox, and radio box holds 3:1. architecture:theme-tokens INV13 describes --color-border-control for this, but Core does not read it yet. If Core reads that token, Glass sets it instead and drops the three overrides.
    3. Data tokens. Glass sets --color-data-categorical-* to its card hues, and sets --color-data-neutral and --color-data-gray-1…5 to navy stops, because Core's values for those differ by mode. Gothic's record rejected data overrides for Gothic. Glass does the opposite on purpose, so that charts match the card hues.
    4. The glows in the elevated AppShell. The app-shell target paints the glows, and layout-content is transparent. In the elevated layout with both a top nav and a side nav, the side nav, its layout panel, and the content backdrop paint opaque surfaces, so the glows stay hidden there. They show in content-only and top-nav-only shells (see the screenshot). I did not add overrides for side-nav or layout-panel, because the result is a hard edge at the content backdrop. Is that worth a follow-up, or are the glows fine as they are?
    5. A new npm package. The first publish of @astryxdesign/theme-glass may need trusted publishing set up (scripts/npm/setup-trusted-publishing.mjs).

Evidence

Measured contrast. A hued card is measured at its top-left corner, where its tint is strongest. Translucent layers are composited over their opaque surface. Each floor is asserted in glassTheme.test.ts.

Pairing Lowest measured
Primary / secondary text, every surface 14.69 / 6.61:1
Accent text, every surface 9.70:1
Focus ring, every surface 6.85:1
Control edge, every surface 3.99:1
Text on the accent fill 8.19:1
Hue text on its tint, every surface 7.06:1 (red)
Secondary text, hued card corner 4.78:1 (yellow)
Hue focus ring, hued card corner 5.18:1 (purple)
Control edge, hued card corner 3.28:1 (yellow)
Hue border vs. page, card, card corner 3.20:1 (red)

The shared first-party tests also pass with Glass added: badge, muted status, status text, syntax punctuation, secondary selector parity, secondary text, segmented-control labels, and the built-theme media-surface accent test.

Screenshots

These come from the repo's own demo surfaces (the docsite playground and Storybook), rendered in Glass:

  • Analytics dashboard template (playground): charts, stat tiles, and stacked bars
image
  • Plain and hued cards (playground): the accent, progress bars, and links follow each card's hue
image
  • Form states (playground): focus, error, disabled, a checkbox, and an open menu inside a purple card
image
  • Table in a card (Storybook)
image
  • Form dialog (Storybook)
image
  • Field status variants (Storybook)
image
  • App shell glows, top nav only (Storybook)
image

The Storybook captures use the system font, because Storybook does not load Figtree. The playground captures use Figtree.

Scope

Components: themes/glass (new); registrations in apps/storybook, apps/sandbox, apps/docsite, packages/cli (bundled templates, discover list, goldens), packages/native (generated Swift theme, test lists), scripts (shared theme contrast tests)

  • One capability is added.
  • Unrelated fixes, cleanup, and policy changes were removed or split.
  • Consumer docs, focused tests, and migration evidence ship with the feature.
  • Public text and artifacts contain no internal Meta context.

Size: pnpm review:pre counts about 5,400 authored lines, over the 2,000-line guideline. Most of that is the palette receipt, the generated ramps, the CLI template copies that bundle:cli-themes writes, and the generated Swift theme. The hand-written theme source is about 430 lines.

CI impact: .github/workflows/ci.yml adds -F @astryxdesign/theme-glass to the existing "Build docsite workspace dependencies" step. That step runs on a standard runner with --workspace-concurrency=4. Expect a few extra seconds for one more theme build in that step, and no new jobs. This is not measured.

Testing

  • pnpm -F @astryxdesign/theme-glass build: theme CSS (no light-dark()), ESM/CJS, and declarations
  • pnpm vitest run packages/themes/glass scripts/generate-glass-palette-refs.test.mjs: 83 tests, including the palette receipt reproduction
  • The shared theme tests, CLI goldens and bundle, docsite registry and nav tests, knowledge paths, and native generator tests: 23 files, 629 tests, all passing
  • pnpm test:node: passes except 20 tests in 8 files (offline-media, theme-cut-short, and the theme-edit app-copy tests). Those fail the same way on a clean origin/main checkout in the same environment.
  • pnpm check:repo (including check:glass-palette-refs, check:knowledge, check:changesets, and check:cli-structure), ESLint at ASTRYX_STRICT_LINT=1 on every touched file, and Prettier
  • tsc --noEmit for Storybook
  • node packages/native/scripts/swift-ios-theme.mjs: no warnings
  • pnpm review:pre: 0 findings; merges clean into origin/main
  • Not run: the Swift tests (no macOS), pnpm test:ui, and the ci:run-visual / ci:run-a11y suites. Glass is a new theme in the Storybook preview, so the visual gate reports its shots as unbaselined until they are accepted.

Writing rubric results

Records touched: packages/themes/glass/glass.spec.md (new) and packages/native/specs/swift/library/theme-generator.md (one word added to the published theme list).

  • R1 narration: the Inheritance section said Neutral's values were "copied into the Glass source". That describes the change, so it now says Glass carries the same values in its own source. No other narration.
  • R2 research in the record: none. The contrast table is measured evidence for this theme's pairings.
  • R3 evidence naming a change: none. The verification cells name tests and states.
  • R4 rejected alternatives over one line or outside a decision: three, each one line inside DEC-1, DEC-2, and DEC-4.
  • R5 pull request or issue references remaining: none (searched for # followed by digits, /pull/, and /issues/).
  • R6 ruled open questions still listing options: none. OQ1–OQ3 are unanswered. OQ2 and OQ3 keep their two options for the owner.
  • R7 project status (build status or work order): one found. OQ3 said Glass sets a token "once Core reads it", so it now states the present fact that Core does not read that token. The elevated-shell glow limit is stated as present behavior.

Glass (`@astryxdesign/theme-glass`) is a dark-only theme for dashboards:
a deep navy canvas with soft glows on the app shell, glass cards with a
light top edge, and one vivid hue per colored card. `<Card variant="<hue>">`
tints the card and points its accent at the hue, so the charts, progress
bars, links, and focus rings inside it match.

- New package modeled on Gothic: palette request, generated dark ramps
  and receipt, selected palette refs, icons, README, and a draft theme
  record (`theme:glass`).
- Contrast tests for text, accent, focus ring, control edges, and borders
  on every surface and every hue, plus a light/dark parity test.
- Registered in Storybook, the sandbox, the docsite, the CLI bundle and
  discover list, the native Swift themes, the release config, and the
  shared first-party contrast tests.
@vercel

vercel Bot commented Nov 17, 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 17, 2026 6:29am UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 17, 2026
@github-actions github-actions Bot added community Authored by a community contributor (not on the eng/design team) needs:code-review High-risk change (new package/component/API) — needs human code review before merge needs:design-review Affects visuals — Design should review labels Nov 17, 2026
@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 17, 2026
@astracat-bot

astracat-bot Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
❓ Needs maintainer input (for maintainers only) Nov 24, 2026, 4:20 AM UTC

@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · f42c6b1

Storybook · Sandbox · built from this PR's head

Package size:

  • @astryxdesign/cli 5.25 MB packed (+8.0 kB); no new dependencies
  • @astryxdesign/theme-glass 30.3 kB packed (new); new dependencies: lucide-react, @astryxdesign/core, react

API changes: theme-glass not in the merge base's build

Wide change (shared styles: packages/themes/glass/fonts.css, packages/themes/glass/fonts.css.d.ts, packages/themes/glass/package.json, and 10 more): add ci:run-visual for Visual, ci:run-a11y for Accessibility, ci:run-rtl for RTL.

CI impact: −2.1 job-min per update · pool −1.2% · time to green +9.8 min · standard runners ⚠️
Before After Change
Job-minutes per PR update 182 179.9 −2.1
Runner pool, runner-minutes a day 63,754 63,008 −746 (−1.2%)
Average concurrent jobs 44.3 43.8 −0.5
Time to green (median → this run) 43.5 min 53.3 min +9.8 min
Runs a day 350 350 0

Changed jobs: docsite-build changed: standard

Flags: time to green +9.8 min.

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.


Generated by PR Enrichment workflow | View full report

@cixzhang

Copy link
Copy Markdown
Contributor

(Posted by Cindy's agent.) Thank you for Glass, @beribener, and for the care in the dark data-dense palette! Adding a new built-in theme is a product decision for the Astryx owner, so this is with her now alongside a few other new-option requests. We'll follow up here as soon as there's an answer; no changes are needed from you in the meantime.

@rubyycheung

Copy link
Copy Markdown
Contributor

Messaged you separately 🙂

@cixzhang cixzhang 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.

(Posted by Cindy's agent.) Thank you again for Glass, @beribener. As we said earlier, whether Astryx adds a new built-in theme is a product decision that's with the maintainers, and we'll follow up here when it's made. Meanwhile, here's a quality pass against the theme records, so Glass is ready whichever way that goes; there's no rush.

What's already strong:

  • Contrast: secondary text reads at about 6.6–7.9:1 on the body, card and popover surfaces, and text on the accent at about 8.2:1, well above the 4.5:1 the theme-token rules ask for. The status, badge, muted-status and syntax checks pass with Glass.
  • Controls: field, checkbox and radio edges reach 3:1, which is the outcome the control-edge rule wants (WCAG 1.4.11).
  • Token coverage: every mode-dependent colour is set, so Glass renders the same in light and dark mode.
  • Package structure: the package follows the published-theme layout (., ./built, ./theme.css, ./fonts.css, standalone with no extends). The CLI template and the native theme regenerate byte for byte.

Two things to change, both about what a person sees:

  1. Selected and raised cards look like plain cards. The card rule (and each hue rule) replaces Card's own shadow and border colour. In Glass, a selected SelectableCard therefore looks the same as an unselected one (its record draws the selected state as an inset ring plus a matching border), and Card's elevation has no visible effect. Someone choosing between selectable cards can't tell which one they picked. Please let the selected ring and elevation come through, for example by layering the glass edge with Card's state shadow instead of replacing it.
  2. Two documented hued-card behaviours don't render. The README and glass.spec.md say a hued card gets a hued border and that focus rings inside it follow the hue. In the built theme, hued cards draw a 0px border and focus rings keep the page accent. Either draw both (a border width in the hue rule, and --focus-outline-color beside --color-accent), or drop those claims and the test checks that assert them.

Maintainers will also check the new external links in the README (icon and font sites) as part of their review. Thanks for all the work here!

@astracat-bot

astracat-bot Bot commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

In reply to @cixzhang

I'll run a full review to re-check this with your note.

@beribener

Copy link
Copy Markdown
Author

Addressed above concerns and committed internally (not here). Should I withdraw this PR?

@astracat-bot

astracat-bot Bot commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

In reply to @beribener

Reviews run against commits pushed to this PR branch, and the current head here is f42c6b1; changes committed elsewhere are not visible on this PR. Whether to withdraw it is a call for you and the maintainers.

@beribener

Copy link
Copy Markdown
Author

closing; will follow up internally.

@beribener beribener closed this Nov 24, 2026
@github-actions
github-actions Bot deleted the beribener/theme-glass branch November 25, 2026 06:04

This branch was successfully deployed

1 active deployment
Preview — f42c6b12 Deployed Nov 17, 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. community Authored by a community contributor (not on the eng/design team) needs:code-review High-risk change (new package/component/API) — needs human code review before merge needs:design-review Affects visuals — Design should review needs:spec-owner-review Current knowledge records await owner approval

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[RFC] Glass: a built-in dark theme for dashboards and data-dense apps

3 participants