Plate every region of bare-sky text under the scene with one rule

skyPlate.css.ts joins the room and page headers, the room list, list pages, the
typing and Following bars, non-bubble messages and the room intro to the sign-in
card's opaque --sky-bubble plate, with the plate's ink and link tokens, at all
widths. The estate title bar's own plate goes: the shared header rule covers it.
skyTheme.test.ts pins the link ratios on bare sky as well (day 5.25, night 2.36).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Void 2026-11-09 22:25:59 +00:00
commit ce16609c76
4 changed files with 64 additions and 31 deletions

View file

@ -1,7 +1,9 @@
import classNames from 'classnames';
import React, { useCallback, useState } from 'react';
import { Avatar, Box, Button, Spinner, Text, as } from 'folds';
import { Room } from 'matrix-js-sdk';
import { useAtomValue } from 'jotai';
import { SkyPlate } from '../../features/scene/skyPlate.css';
import { IRoomCreateContent, Membership, StateEvent } from '../../../types/matrix/room';
import { getMemberDisplayName, getStateEvent } from '../../utils/room';
import { useMatrixClient } from '../../hooks/useMatrixClient';
@ -23,7 +25,7 @@ export type RoomIntroProps = {
room: Room;
};
export const RoomIntro = as<'div', RoomIntroProps>(({ room, ...props }, ref) => {
export const RoomIntro = as<'div', RoomIntroProps>(({ room, className, ...props }, ref) => {
const mx = useMatrixClient();
const useAuthentication = useMediaAuthentication();
const { navigateRoom } = useRoomNavigate();
@ -50,7 +52,7 @@ export const RoomIntro = as<'div', RoomIntroProps>(({ room, ...props }, ref) =>
const [hour24Clock] = useSetting(settingsAtom, 'hour24Clock');
return (
<Box direction="Column" grow="Yes" gap="500" {...props} ref={ref}>
<Box direction="Column" grow="Yes" gap="500" className={classNames(SkyPlate, className)} {...props} ref={ref}>
<Box>
<Avatar size="500">
<RoomAvatar

View file

@ -2,7 +2,6 @@ import React, { MouseEventHandler, ReactNode, useCallback, useMemo, useRef } fro
import { useNavigate } from 'react-router-dom';
import { useAtom, useAtomValue, useSetAtom } from 'jotai';
import { Avatar, Box, Chip, Icon, IconButton, Icons, Spinner, Text, color, config } from 'folds';
import classNames from 'classnames';
import { PageNav, PageNavContent, PageNavHeader } from '../../components/page';
import {
NavButton,
@ -43,7 +42,6 @@ import { EstateRoom, EstateTier } from './buildEstate';
import { activateEstateRoom, awaitMyJoin } from './joinEstateRoom';
import { useEstate, useEstateRootId } from './useEstate';
import * as css from './EstateNavigator.css';
import { SkyPlate } from '../scene/skyPlate.css';
import { SkyStateControl } from '../scene/SkyStateControl';
/** How long a tap waits for the client store to hold the room it just joined. */
@ -292,7 +290,7 @@ export function EstateNavigator() {
return (
<PageNav>
<PageNavHeader>
<Box alignItems="Center" grow="Yes" gap="300" className={classNames(css.Targets, SkyPlate)}>
<Box alignItems="Center" grow="Yes" gap="300" className={css.Targets}>
<Box grow="Yes">
<Text size="H4" truncate>
{title}

View file

@ -1,32 +1,63 @@
import { globalStyle, style } from '@vanilla-extract/css';
import { config } from 'folds';
import { color, config } from 'folds';
import { MessageBase, BubbleContent } from '../../components/message/layout/layout.css';
import { PageContent, PageNavContent } from '../../components/page/style.css';
import { RoomViewFollowing } from '../room/RoomViewFollowing.css';
import { RoomViewTyping } from '../room/RoomViewTyping.css';
import { SKY_PLATE_FALLBACK } from './skyPlate';
// Over the scene (html[data-scene]) the signed-in shell is clear, so text outside a chat bubble
// would sit on bare sky, which a sky state can make light, dark or both (dusk): no ink clears
// 4.5:1 on all of that (skyTheme.test.ts). Such text gets a plate instead, never a halo.
// Over the scene (html[data-scene]) the signed-in shell is clear (sceneShell.css.ts), so text
// outside a chat bubble would sit on bare sky, which a sky state can make light, dark or both
// (dusk): no ink clears 4.5:1 on all of that (skyTheme.test.ts). Every such region is a plate
// instead, the sign-in card's opaque --sky-bubble fill, with its own ink and link, so what was
// checked for the card holds everywhere. One rule, below; a region joins it by class or by tag.
const scene = ':root[data-scene]';
const fill = `var(--sky-bubble, ${SKY_PLATE_FALLBACK.fill})`;
const text = `var(--sky-bubble-text, ${SKY_PLATE_FALLBACK.text})`;
const plate = {
/** A region with no component class of its own (the room intro) joins the plate with this. */
export const SkyPlate = style({});
// A recipe's first class is its base style.
const base = (recipe: () => string) => `.${recipe().split(' ')[0]}`;
const regions = [
`.${SkyPlate}`,
// Title bars: the room header, the room list's header, every page header.
'#root header',
// The room list, and the pages that are lists (explore, inbox, search).
`.${PageNavContent}`,
`.${PageContent}`,
// The bars over the composer.
`.${RoomViewTyping}`,
base(RoomViewFollowing),
// A message that is not a bubble (Modern, Compact) is plain text on the scene.
`${base(MessageBase)}:not(:has(.${BubbleContent}))`,
];
// Only inside #root: menus and dialogs render in #portalContainer with their own themed fill.
const within = (ancestor: string) =>
regions.map((r) => `${ancestor} ${r.startsWith('#root') ? '' : '#root '}${r}`).join(', ');
globalStyle(within(scene), {
backgroundColor: fill,
color: text,
borderRadius: config.radii.R400,
} as const;
// Themed ink was chosen for the clear shell; inside the plate every token reads the plate's.
vars: {
[color.Background.OnContainer]: text,
[color.Surface.OnContainer]: text,
[color.SurfaceVariant.OnContainer]: text,
},
});
globalStyle(`${scene} #root header`, { borderRadius: config.radii.R400 });
/** A title-bar group whose controls and title sit on the plate. */
export const SkyPlate = style({});
globalStyle(`${scene} ${SkyPlate}`, { ...plate, padding: `0 ${config.space.S100}` });
// Controls in the plate take its ink; their themed ink was chosen for the clear shell.
globalStyle(`${scene} ${SkyPlate} button`, { color: 'inherit' });
// A message that is not a bubble (Modern, Compact) is plain text on the scene: plate the row.
globalStyle(`${scene} ${MessageBase}:not(:has(.${BubbleContent}))`, plate);
// Links on a plate read against the plate. The Midnight and Noonday themes set their own
// --tc-link for it; the rest take the fallback, as the sign-in card does.
globalStyle(`${scene} body:not(.gamecult-theme) ${SkyPlate}, ${scene} body:not(.gamecult-theme) ${MessageBase}`, {
// Links read against the plate. The Midnight and Noonday themes set their own --tc-link for it;
// the other themes take the fallback, as the sign-in card does.
globalStyle(within(`${scene} body:not(.gamecult-theme)`), {
vars: { '--tc-link': SKY_PLATE_FALLBACK.link },
});
globalStyle(`${scene} #root .${SkyPlate}`, {
padding: config.space.S400,
borderRadius: config.radii.R400,
});

View file

@ -39,19 +39,21 @@ describe('skyThemeId', () => {
});
describe('ink of the theme a state picks, on bare sky', () => {
// [state, text ratio, link ratio]; a theme's own ink is not chosen for bare sky, so only day
// and night text pass (Nibu's measurement, skyState.test.ts). Links never rest on bare sky.
const cells: [SkyState, string, string, string, string][] = [
['day', 'noonday-sky', '#342d25', '7.62', '#2a4f27'],
['dusk', 'noonday-sky', '#342d25', '1.00', '#2a4f27'],
['night', 'midnight-sky', '#aeccff', '5.05', '#609385'],
// Per state: the picked theme, its ink and link, and their ratios on bare sky. A theme's own
// ink is not chosen for bare sky, so only day and night text pass (skyState.test.ts), and no
// link does (night 2.36): links never rest on bare sky, they sit on the plate below.
const cells: [SkyState, string, string, string, string, string][] = [
['day', 'noonday-sky', '#342d25', '7.62', '#2a4f27', '5.25'],
['dusk', 'noonday-sky', '#342d25', '1.00', '#2a4f27', '1.00'],
['night', 'midnight-sky', '#aeccff', '5.05', '#609385', '2.36'],
];
it.each(cells)('%s with %s: ink %s measures %s', (state, id, ink, want, link) => {
it.each(cells)('%s with %s: ink %s is %s, link %s is %s', (state, id, ink, want, link, wantLink) => {
const sky = SKY[id as keyof typeof SKY];
expect(sky.tokens.Background.OnContainer).toBe(ink);
expect(sky.link).toBe(link);
expect(r2(ratio(ink, skyBackdrop(state)))).toBe(want);
expect(r2(ratio(link, skyBackdrop(state)))).toBe(wantLink);
});
it('only the cells that clear AA on bare sky carry text there', () => {