Skip to content

Commit d587f48

Browse files
committed
docs(Tooltip): bound the inverted text roles to primary, secondary and accent, and the derivation to hex or rgb() themes
1 parent 8718581 commit d587f48

4 files changed

Lines changed: 8 additions & 6 deletions

File tree

‎.changeset/tooltip-content-media-theme.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@
88
'@astryxdesign/theme-y2k': patch
99
---
1010

11-
[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 with concrete 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.
11+
[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.
1212

1313
@cixzhang

‎docs/architecture/theme-tokens.md‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -237,12 +237,14 @@ then have contradictory winners.
237237
`#445564`, has the hue and chroma of `--color-icon-secondary` (`#4E606F`)
238238
and is the smallest drop in CIE L* that meets 4.5:1 on every default tint.
239239
The lowest pair is `--color-background-gray` over the page body (4.52:1).
240-
- **INV15 — Text on the inverted surface has its own roles.** Token-colored
241-
content on `--color-background-inverted` (a tooltip) takes three roles:
240+
- **INV15 — Text on the inverted surface has its own roles.** Text and icons
241+
colored by the primary, secondary or accent tokens on
242+
`--color-background-inverted` (a tooltip) take three roles:
242243
`--color-text-primary-inverted`, `--color-text-secondary-inverted` and
243244
`--color-text-accent-inverted`. A theme that sets them keeps its values. A
244245
theme that sets none of them, but sets a colour they are computed from (its
245-
surface, inverted surface, secondary text or accent), gets values computed
246+
surface, inverted surface, secondary text or accent) in hex or `rgb()`, gets
247+
values computed
246248
when the theme is generated: primary is the theme's surface colour, else
247249
white or black, whichever meets 4.5:1 on the inverted surface; secondary and
248250
accent are the theme's secondary text and accent at the nearest lightness

‎docs/specs/components/Tooltip/Tooltip.spec.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ Consumer migration instructions belong in consumer docs and release notes.
253253
| Anatomy or state | Design requirement | Representation authority | Hierarchy role | Component contract |
254254
| ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------ | -------------- | ------------------ |
255255
| 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 |
256-
| Tooltip text | Presents supplied content within the owned surface. Token-colored content takes the theme's text roles for the inverted surface (`--color-text-primary-inverted`, `--color-text-secondary-inverted`, `--color-text-accent-inverted`); inherited text keeps the `tooltip` surface's color (`theme-application` INV8). | Current source and public docs | Prominent | FR1 |
256+
| 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 |
257257

258258
The trigger is caller-owned and outside this anatomy. The current implementation
259259
has no arrow element.

‎packages/core/src/theme/tokens.stylex.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export const colorDefaults = {
6161
'--color-background-error-inverted': 'light-dark(#AA071E, #E3193B)',
6262
// Text on the inverted surface (a tooltip): the surface's own text colour,
6363
// and the secondary text and the accent stepped to 4.5:1 on that surface.
64-
// A theme's own values come from tooltipTextDerivation.
64+
// A theme that sets none of them gets values from tooltipTextDerivation.
6565
'--color-text-primary-inverted': 'light-dark(#FFFFFF, #1F1F22)',
6666
'--color-text-secondary-inverted': 'light-dark(#6D8090, #71767C)',
6767
'--color-text-accent-inverted': 'light-dark(#2279F6, #0171E3)',

0 commit comments

Comments
 (0)