Skip to content
Open
Show file tree
Hide file tree
Changes from 33 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
de9bf69
fix(Tooltip): content keeps contrast on the inverted surface
cixzhang Nov 17, 2026
28ddf08
fix(Tooltip): keep the media-side helper inside useTooltip
cixzhang Nov 17, 2026
63e5d50
fix(Tooltip): measure the content's media side inside the open layer;…
cixzhang Nov 17, 2026
80b6792
fix(Tooltip): content reads the media tokens and keeps the surface te…
cixzhang Nov 17, 2026
805e5f9
fix(Tooltip): string and number content renders without the media wra…
cixzhang Nov 17, 2026
f9d7d99
docs(Tooltip): the media wrapper comment says it renders while closed
cixzhang Nov 18, 2026
c9fae25
Merge remote-tracking branch 'refs/remotes/l4/main-new' into lane4/pr…
cixzhang Nov 18, 2026
22494e5
perf(Tooltip): the media context adds about 0.4 to 1.3 KB to a page, …
cixzhang Nov 18, 2026
fc6ef3b
Merge main into #12410
cixzhang Nov 19, 2026
d28b067
Merge main into fix-tooltip-content-contrast
cixzhang Dec 1, 2026
2a718c7
fix(Tooltip): the content's side follows the theme's surface in the p…
cixzhang Dec 1, 2026
2212a34
fix(Tooltip): keep the side code local to Tooltip and out of the firs…
cixzhang Dec 2, 2026
d849f49
docs(Tooltip): record the content contrast gap before the side module…
cixzhang Dec 2, 2026
305ce5e
fix(Tooltip): content takes the surface's text color until its side i…
cixzhang Dec 2, 2026
499e914
docs(Tooltip): the pre-measurement content color is unmuted
cixzhang Dec 2, 2026
0ff348c
chore(changeset): name the CLI for the Gothic and Matcha theme templates
cixzhang Dec 2, 2026
4abee12
perf(Tooltip): import the media side statically; no loader and no aft…
cixzhang Dec 3, 2026
6e51074
probe: surface-only content colors, no measurement (size probe, not f…
cixzhang Dec 3, 2026
bb8f887
wip: tooltip text derivation
cixzhang Dec 3, 2026
5fd30c0
card-depth A: tooltip text tokens derived per theme; tooltip content …
cixzhang Dec 3, 2026
45000d8
card-depth A v2: grammar names (--color-text-*-inverted); mapping on …
cixzhang Dec 3, 2026
1e53364
card-depth A v3: render tooltip children directly; deps as on main (d…
cixzhang Dec 3, 2026
5739253
fix(Tooltip): token-colored content takes the theme's text roles for …
cixzhang Dec 3, 2026
65efcd0
Merge main into fix-tooltip-content-contrast
cixzhang Dec 3, 2026
a901598
docs(theme-tokens): INV15 records the text roles on the inverted surf…
cixzhang Dec 3, 2026
be8899d
fix(Tooltip): token docs list the inverted text roles; the derivation…
cixzhang Dec 3, 2026
17f3965
chore(changeset): name the CLI, whose token docs list the inverted roles
cixzhang Dec 3, 2026
9792af4
chore(Tooltip): narrow the changeset to the roles it moves; drop the …
cixzhang Dec 3, 2026
e9540c4
chore(theme): the derivation header names no record
cixzhang Dec 3, 2026
ad35457
fix(themes): Butter, Gothic, Matcha, Stone and Y2K set the inverted t…
cixzhang Dec 3, 2026
19f5653
fix(theme): share the readable-ink and ratio helpers; regenerate the …
cixzhang Dec 3, 2026
8718581
style(theme): format statusColor.ts
cixzhang Dec 3, 2026
d587f48
docs(Tooltip): bound the inverted text roles to primary, secondary an…
cixzhang Dec 3, 2026
b8d3143
docs(theme-tokens): INV15 scopes to tooltip content and to themes who…
cixzhang Dec 3, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .changeset/tooltip-content-media-theme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
'@astryxdesign/core': patch
Comment thread
astracat-bot[bot] marked this conversation as resolved.
Resolved
'@astryxdesign/cli': patch
'@astryxdesign/theme-butter': patch
'@astryxdesign/theme-gothic': patch
'@astryxdesign/theme-matcha': patch
'@astryxdesign/theme-stone': patch
'@astryxdesign/theme-y2k': patch
---

[fix] Tooltip content that uses `Text`, or icons colored by the primary, secondary or accent tokens, as the Tooltip docs show, now reads on the tooltip's inverted surface instead of taking the surface's own color. Its primary, secondary and accent text and icon colors (status and hue colors keep the page's values) come from three new theme tokens, `--color-text-primary-inverted`, `--color-text-secondary-inverted` and `--color-text-accent-inverted`. A theme written in hex or `rgb()` colors that does not set them gets values computed from its own colors when the theme is generated: the surface's text color, and the theme's secondary text and accent at 4.5:1 on `--color-background-inverted`. Where a theme's accent is the tooltip surface's own color, accent text takes the secondary color. The Butter, Gothic, Matcha, Stone and Y2K themes, and their templates that `astryx` copies into a project, set the three roles to named stops of their own palettes. Plain text keeps the tooltip's own text color. Nothing is measured on the page. The token reference that `astryx docs tokens` prints lists the three roles.

@cixzhang
53 changes: 53 additions & 0 deletions apps/storybook/stories/Tooltip.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import type {Meta, StoryObj} from '@storybook/react';
import {Tooltip, useTooltip} from '@astryxdesign/core/Tooltip';
import {Button} from '@astryxdesign/core/Button';
import {HStack} from '@astryxdesign/core/Layout';
import {Text} from '@astryxdesign/core/Text';
import {Icon} from '@astryxdesign/core/Icon';

const meta: Meta<typeof Tooltip> = {
title: 'Core/Tooltip',
Expand Down Expand Up @@ -415,3 +417,54 @@ export const TouchTriggers: Story = {
</div>
),
};

/**
* Rich content on the inverted surface: a plain string, the docs' `Text`
* example, default and secondary `Text`, an icon with text, and bare text
* mixed with an element stay readable in light and dark.
*/
export const RichContent: Story = {
render: () => (
<div style={{padding: '80px 24px'}}>
<HStack gap={4}>
<Tooltip content="Plain string" isDefaultOpen>
<Button label="Plain string" />
</Tooltip>
<Tooltip content={<Text type="body">Body text</Text>} isDefaultOpen>
<Button label="Text body" />
</Tooltip>
<Tooltip content={<Text>Default text</Text>} isDefaultOpen>
<Button label="Text default" />
</Tooltip>
<Tooltip
content={
<Text type="supporting" color="secondary">
Secondary text
</Text>
}
isDefaultOpen>
<Button label="Text secondary" />
</Tooltip>
<Tooltip
content={
<HStack gap={1}>
<Icon icon="calendar" size="sm" />
<Text type="body">With icon</Text>
</HStack>
}
isDefaultOpen>
<Button label="Icon and text" />
</Tooltip>
<Tooltip
content={
<>
Saved <strong>now</strong>
</>
}
isDefaultOpen>
<Button label="Mixed content" />
</Tooltip>
</HStack>
</div>
),
};
24 changes: 23 additions & 1 deletion docs/architecture/theme-tokens.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ deciding_specs: [spec:AST-006/DEC-1, spec:AST-006/DEC-5]
"INV9",
"INV10",
"INV11",
"INV12"
"INV12",
"INV15"
]
}
}
Expand Down Expand Up @@ -236,6 +237,23 @@ then have contradictory winners.
`#445564`, has the hue and chroma of `--color-icon-secondary` (`#4E606F`)
and is the smallest drop in CIE L* that meets 4.5:1 on every default tint.
The lowest pair is `--color-background-gray` over the page body (4.52:1).
- **INV15 — Text on the inverted surface has its own roles.** Text and icons
colored by the primary, secondary or accent tokens on
`--color-background-inverted` (a tooltip) take three roles:
Comment thread
astracat-bot[bot] marked this conversation as resolved.
Resolved
`--color-text-primary-inverted`, `--color-text-secondary-inverted` and
`--color-text-accent-inverted`. A theme that sets them keeps its values. A
theme that sets none of them, but sets a colour they are computed from (its
surface, inverted surface, secondary text or accent) in hex or `rgb()`, gets
values computed
Comment thread
astracat-bot[bot] marked this conversation as resolved.
Resolved
when the theme is generated: primary is the theme's surface colour, else
Comment thread
astracat-bot[bot] marked this conversation as resolved.
Resolved
white or black, whichever meets 4.5:1 on the inverted surface; secondary and
accent are the theme's secondary text and accent at the nearest lightness
that meets 4.5:1 on the inverted surface, in light and dark mode. Where the
theme's accent equals the inverted surface, the accent role takes the
secondary role's value. A theme whose record requires named palette stops
sets the three roles to its own stops that meet 4.5:1. Core's
defaults hold the values computed from Core's own colours. Nothing is
measured on the page (`spec:AST-020` FR1; WCAG 2.2 SC 1.4.3).

This record does not own:

Expand Down Expand Up @@ -290,6 +308,9 @@ does not silently change authoring, runtime, compiler, or component contracts.
- `packages/core/src/theme/defineTheme.ts` aggregates token types/defaults for
validation and authoring; it does not become a second token source.
- `packages/core/src/theme/tokens.ts` owns server-safe references and resolution.
- `packages/core/src/theme/tooltipTextDerivation.ts` computes the INV15 roles
a theme leaves unset; `statusRoleDefaults.ts` emits them with the status
roles.
- `packages/core/src/theme/localTokens.ts` enforces the boundary between the
portable and enrolled local maps; it does not add local names to this
vocabulary.
Expand Down Expand Up @@ -361,6 +382,7 @@ themes and ties fields to badge theming.
| INV12 | `packages/core/src/theme/contrast.test.ts` "the stock accent pair meets 4.5:1 in the light/dark theme" (current values: light `#0064E0`, dark `#0171E3`, label `#FFFFFF`) | The stock `--color-on-accent` on `--color-accent` falls below 4.5:1 in light or dark mode |
| INV13 | `packages/core/src/theme/contrast.test.ts` resolves `--color-border-control` against the surface and the page body in light and dark for Core's defaults, each theme template and a colour-scale theme | `--color-border-control` falls below 3:1 against the surface or the page body in either mode, for any of them, or a colour-scale theme emits no `--color-border-control` |
| INV14 | `packages/core/src/theme/contrast.test.ts` resolves `--color-text-secondary` on each default palette tint over the surface and the page body for Core's defaults; `expandColorScale.test.ts` does the same over the generated surface and body for each representative colour-scale config | `--color-text-secondary` falls below 4.5:1 on a default palette tint over the surface or the page body in either mode |
| INV15 | `packages/core/src/theme/tooltipTextDerivation.test.ts` checks that each derived role meets 4.5:1 on `--color-background-inverted` in light and dark for Core's defaults and for themes with a dark and with a light inverted surface, and that an authored role is kept; `TooltipContentContrast.a11y.chromium.spec.ts` measures tooltip text on the painted surface in every shipped theme | A derived role falls below 4.5:1 on the inverted surface in either mode, or a theme's own value is overridden |
| Syntax token regions | `syntax/tokens.test.ts` (selector and every token), `Theme.test.tsx` "marks only a wrapper whose theme sets Core color tokens, for the syntax token rule", and `ThemeNestedSyntaxValues.a11y.chromium.spec.ts` with the CodeTheme "Nested Themes" story, as shipped and lowered | Code in a nested Theme that sets Core color tokens shows the page's syntax colors, or a components-only nested theme, a SyntaxTheme inside a Theme, or a SyntaxTheme around one loses its syntax colors |
| Released token compatibility | Type checking plus representative package/source builds | A released CSS variable or typed token name disappears without an explicit migration decision |
| Visual defaults | Real Chromium examples in light, dark, status, and high-contrast contexts | A changed default produces unreadable or semantically inconsistent output |
2 changes: 1 addition & 1 deletion docs/specs/components/Tooltip/Tooltip.spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ Consumer migration instructions belong in consumer docs and release notes.
| Anatomy or state | Design requirement | Representation authority | Hierarchy role | Component contract |
| ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------ | -------------- | ------------------ |
| Tooltip surface | Presents the current painted overlay surface, in the theme's inverted surface color (`--color-background-inverted`, the surface Toast paints) with the page surface color (`--color-background-surface`) as its text. The layer is always a scroll container (`overflow-y: auto`), so `position: sticky` and `scroll(nearest)` timelines inside its content resolve against the layer, not the page. | Current source and public docs | Supporting | FR1 |
| Tooltip text | Presents supplied content within the owned surface. | Current source and public docs | Prominent | FR1 |
| Tooltip text | Presents supplied content within the owned surface. Text and icons colored by the primary, secondary or accent tokens take the theme's text roles for the inverted surface (`--color-text-primary-inverted`, `--color-text-secondary-inverted`, `--color-text-accent-inverted`); status, hue and disabled colors keep the page's values, and inherited text keeps the `tooltip` surface's color. | Current source and public docs | Prominent | FR1 |

The trigger is caller-owned and outside this anatomy. The current implementation
has no arrow element.
Expand Down
15 changes: 15 additions & 0 deletions packages/cli/assets/docs/tree/tokens-color.doc.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,21 @@ export const docs = {
"#AA071E",
"#E3193B"
],
[
"--color-text-primary-inverted",
"#FFFFFF",
"#1F1F22"
],
[
"--color-text-secondary-inverted",
"#6D8090",
"#71767C"
],
[
"--color-text-accent-inverted",
"#2279F6",
"#0171E3"
],
[
"--color-info",
"#0064E0",
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/assets/docs/tree/tokens.doc.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

// AUTO-GENERATED — do not edit manually.
// Run: node scripts/generate-token-docs.mjs
// Total: 286 tokens across 15 categories.
// Total: 289 tokens across 15 categories.

/** @type {import('@astryxdesign/cli/authoring').NamespaceDoc} */
export const docs = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
// prettier-ignore
export const butterPaletteRefs = {
neutral: {
light: {0: '#000000', 15: '#1d1c11', 30: '#4a4732', 40: '#725538', 45: '#605f52', 55: '#79786a', 70: '#adac9e', 75: '#c7c4b2', 80: '#d6d3b8', 85: '#e5e3d4', 90: '#f3f2e2', 95: '#fdfbe4', 100: '#ffffff'},
dark: {0: '#000000', 5: '#131107', 10: '#261a13', 15: '#2e2117', 20: '#3a2a1f', 30: '#4a4732', 35: '#49473b', 40: '#725538', 45: '#605f52', 60: '#939184', 70: '#adac9e', 80: '#d6d3b8', 85: '#f0edd4', 90: '#f3f2e2', 95: '#fdfbe4', 100: '#ffffff'},
light: {0: '#000000', 15: '#1d1c11', 30: '#4a4732', 40: '#725538', 45: '#605f52', 55: '#79786a', 60: '#89877a', 70: '#adac9e', 75: '#c7c4b2', 80: '#d6d3b8', 85: '#e5e3d4', 90: '#f3f2e2', 95: '#fdfbe4', 100: '#ffffff'},
dark: {0: '#000000', 5: '#131107', 10: '#261a13', 15: '#2e2117', 20: '#3a2a1f', 30: '#4a4732', 35: '#49473b', 40: '#725538', 45: '#605f52', 50: '#6c6c5e', 60: '#939184', 70: '#adac9e', 80: '#d6d3b8', 85: '#f0edd4', 90: '#f3f2e2', 95: '#fdfbe4', 100: '#ffffff'},
},
accent: {
light: {35: '#194ce8', 40: '#225bff', 55: '#4d82ff'},
dark: {70: '#81a9ff'},
},
yellow: {
dark: {15: '#2c2600', 25: '#443c00', 70: '#bcae4e', 75: '#cdbe59', 85: '#eedf75', 90: '#fdee8c'},
dark: {15: '#2c2600', 25: '#443c00', 45: '#796b00', 70: '#bcae4e', 75: '#cdbe59', 85: '#eedf75', 90: '#fdee8c'},
light: {25: '#443c00', 30: '#514700', 55: '#958500', 70: '#bfae35', 80: '#dfcf5b', 85: '#f0df72', 90: '#fdee8c', 95: '#fff7c0'},
},
purple: {
Expand Down
4 changes: 4 additions & 0 deletions packages/cli/assets/templates/themes/butter/butterTheme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,10 @@ export const butterTheme = defineTheme({
'--color-background-card': [neutral.light[100], neutral.dark[20]],
'--color-background-popover': [neutral.light[100], neutral.dark[20]],
'--color-background-inverted': [neutral.light[15], neutral.dark[95]],
// Text on the inverted surface (a tooltip), on named stops at 4.5:1.
'--color-text-primary-inverted': [neutral.light[100], neutral.dark[15]],
'--color-text-secondary-inverted': [neutral.light[60], neutral.dark[50]],
'--color-text-accent-inverted': [accent.light[55], yellow.dark[45]],

// Status semantics share the Red, Yellow, and Green families.
'--color-error': [red.light[30], red.dark[85]],
Expand Down
5 changes: 5 additions & 0 deletions packages/cli/assets/templates/themes/gothic/gothicTheme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,11 @@ export const gothicTheme = defineTheme({
'--color-background-card': neutral.dark[15],
'--color-background-popover': neutral.dark[20],
'--color-background-inverted': neutral.dark[95],
// Text on the inverted surface (a tooltip), on named stops at 4.5:1;
// an accent equal to that surface takes the secondary stop.
'--color-text-primary-inverted': neutral.dark[10],
'--color-text-secondary-inverted': neutral.dark[50],
'--color-text-accent-inverted': neutral.dark[50],

'--color-success': green.dark[75],
'--color-success-muted': green.dark[75],
Expand Down
Loading
Loading