Version 8.8.0

All pages

Theme

The app comes light or dark. The user chooses with the sun/moon toggle at the top of every screen, or under Appearance in the study preferences, where "As my browser" follows prefers-color-scheme as it changes and is the default. The preferences choose the colors and the text size too, in either theme.

Where the choice is kept

The theme, the palette and the text size are kept the same way.

Where the theme, the palette and the text size are kept
A choice of theme, palette or text size is kept on this device, and in the instance's preferences when one is open, which set the device's choices when the instance is opened.
The diagram's source
flowchart LR
  accTitle: Where the theme, the palette and the text size are kept
  accDescr: A choice of theme, palette or text size is kept on this device, and in the instance's preferences when one is open, which set the device's choices when the instance is opened.
  choose["A choice"] --> device["This device<br/>localStorage solid-memo:theme,<br/>solid-memo:palette, solid-memo:textSize"]
  choose -->|"an instance is open<br/>and has preferences"| pod["preferences.ttl<br/>sm:theme, sm:palette, sm:textSize"]
  pod -->|"the instance is opened"| device

Writes to an instance's preferences, the one that says whether logging in skips the Connected screen among them (onboarding.md), go one after another, so an earlier choice never overwrites a later one. A save of the study preferences, a switch of scheduler and "Not now" to the invitation to FSRS-6 wait for them, so none is refused for the version a choice made. A failed write (another device saved meanwhile, say) is undone: the app reads the preferences back and shows what they hold. A read of an instance's preferences begun before a choice, or while it was still being written, may be out of date. It is neither shown nor copied to the device (shown and appearanceSettled in preferenceStore.ts), and the read after the choice's write shows what the pod holds. A reload before a write is done opens the instance with the choice its preferences held before and shows it: the newer choice is lost.

The palette's shape lists no concepts, as sm:textFormat's lists none (vocab.md), so a later version's palette, or one of the user's own (below), needs no new format. One this version doesn't know shows as Standard and is kept through a save of the preferences or a switch of scheduler, until another is chosen. A palette of the user's own is one it knows, and choosing a built-in palette replaces it. The theme's shape lists its three, the text size's its four.

Showing it

The stylesheet's dark colors hang off <html data-theme="dark">. A small script in apps/web/index.html (the page the Studio is in too) sets the attribute before the first paint, from the device's choice, else the browser's, so a page never flashes in the other theme. From there packages/ui/src/ui/theme.tsx takes over and sets the theme-color meta tags for the browser's chrome to the page's background (--bg).

Palettes

The colors come in palettes, each in both themes. The user chooses under Colors in the study preferences, where each palette has a one-line description and a swatch drawn in its own colors (an element marked with its data-palette, which its blocks style too). When the browser asks for more contrast (prefers-contrast: more), the preferences suggest High contrast. A choice takes effect at once:

PaletteIdWhat it does
StandardstandardThe app's own colors, the answer buttons from red (Again) to green (Easy).
High contrasthigh-contrastBlack on white, or white on black: text at 7:1 or more, fields' edges at 4.5:1 or more, no page discs, glint or glow, edges in place of soft shadows, and a solid focus ring.
Color-blind friendlycolor-visionStandard's surfaces, with meaning moved off red and green: blue for the primary color and links, orange for warnings, vermilion for danger, and the answer buttons from vermilion through orange, yellow and sky blue to blue.
Parchment (low glare)parchmentWarm surfaces darker than white in the light theme, warm browns in the dark, for readers whom a bright page dazzles, the dimmer text raised to 4.5:1.

The choice is kept in the instance's preferences and on the device, as the theme is (Where the choice is kept), on the device by the device store (deviceChoices.ts, key solid-memo:palette; Standard is no key). It's shown as <html data-palette> (none for Standard), set as data-theme is (Showing it); theme.tsx sets it before setting the theme-color meta tags from the palette's background. The index.html script takes any value shaped like an id (lowercase letters and hyphens, at most 32), so a later palette needs no new script, and an unknown one shows as Standard.

Color roles

Every color the site and the Studio draw with is a role, a custom property such as --bg, --text, --primary-fill or --grade-0, set in palettes.css, which style.css imports. style.css and studio.css write out no color, only roles, two of which they may mix (color-mix(in srgb, …)), as a hovered answer button's tint does.

A palette is two blocks of palettes.css, light and dark: Standard's :root and :root[data-theme="dark"], then another palette's :root[data-palette="…"] and :root[data-palette="…"][data-theme="dark"]. A palette with no blocks shows as Standard. Each block sets every role.

The roles fall into groups:

A block writes a color only as #rrggbb, #rrggbbaa for one seen through (its alpha in 255ths, as the browser keeps it), transparent, another role (var()) or a mix of these. A shadow is lengths and such colors. style.test.ts checks that every block sets every role in these forms and, with studio.test.ts, that the stylesheets write out no color. In every block it checks the contrast of the pairs that hold text (accessibility.md lists them) at 4.5:1, and of fields' edges and a chart's steps (WCAG 1.4.11) at 3:1; in High contrast, 7:1 and 4.5:1 (contrastTargets).

Color-blind friendly's answer buttons are also checked as protanopia, deuteranopia and tritanopia see them. style.test.ts simulates each with Machado, Oliveira and Fernandes' model (2009), and needs each grade at least 0.08 from the next in OKLab, four times the smallest noticeable difference. In every palette the buttons' names, not their colors, say which grade is which. The tests read the blocks with testing/contrast.ts; WCAG's contrast ratio and color mixing are the app's own contrast.ts, which the palette editor's check (checkPalette) uses too.

Some colors stay fixed whatever the palette:

Palette sources

Some of the palettes' colors come from published color schemes, credited here; only the values are taken, no file:

Palettes of one's own

Under Colors, "Design a palette" opens the palette editor (#/palette?instance=…, routing.md). The user's own palettes are listed after the built-in ones, each with its swatch and a link to edit it. In the editor the user names the palette, chooses its base, and in each theme a color for each role below, starting at the base's:

RoleWhat it colors
--bg, --surface, --surface-sunkenThe page, cards and panels, and surfaces set into them
--text, --text-mutedThe text, and text that says less, such as a hint
--border, --control-borderLines, and the edges of fields
--primaryRings, lines and text in the primary color, and the focus ring
--primary-fill, --on-primaryA primary button, and its text
--link, --danger, --warning-textLinks, and danger and warning text
--grade-0 to --grade-5The answer buttons, from 0 (Blackout, or Again) to 5 (Easy)

Every other role is the base's, except a few mixed from a role the palette changes (DERIVED in customPalette.ts). A hovered surface is 6% of the text over the surface; a strong border, 20% of the text over the border; a hovered button, 20% of the text over its fill. The tints of the primary color, a link, danger and warning, and the borders of danger and warning, are mixed too. A chart's steps are mixed as the base mixes them, from the palette's primary color, text and sunken surface (SERIES there).

Below a preview in each theme, a table measures, as each color is chosen, every pair that holds text or must be seen against the contrast it needs; a live region says how they stand. The pairs (CHECKED_PAIRS) are:

style.test.ts checks these pairs in the built-in palettes, among the roles a palette of one's own paints, and fails on a pair it checks that the list leaves out. A pair needs what the base needs (Color roles). A palette with a pair below that is saved only after "Use anyway"; one whose text is below 3:1 on the background or on a surface isn't saved. "Save and use" shows the app in it from then on, as choosing it under Colors does.

"Reset colors", under Colors and in the editor, goes back to Standard. It's drawn in Standard's colors (its element marked data-palette="standard", which palettes.css styles as the swatches), so it can be read and pressed whatever a palette does to the page.

Where a palette of one's own is kept

How a palette of one's own is held safe

Anyone who may write the pod may have written a palette. Wherever it's read and painted:

The journeys' accessibility checks take a palette of one's own off the page while they check each built-in palette (testing.md).

Text size

The text comes in four sizes: Default, the browser's own, then Large, Larger and Largest, at 112.5%, 125% and 150% of it. The user chooses under Text size in the study preferences, each size with a sample line at that size, and the choice takes effect at once. It's kept in the instance's preferences and on the device, as the theme is: on the device by the device store (deviceChoices.ts, key solid-memo:textSize; Default is no key). It's shown as <html data-text-size> (none for Default), set as data-palette is. Each size sets the root's font size as a percentage, which the browser's text size multiplies, and --text-scale (1.125, 1.25 or 1.5). The Studio follows; its Comfortable layout is a separate setting, and the two multiply.

The text is sized in rem, its line heights without a unit and its letter spacing in em, so the root's font size scales nearly all of it. What doesn't is kept to a few places, and made to follow:

style.test.ts and studio.test.ts fail on a font size in px other than the focus proxy's 16px; with less, a phone zooms the page as the proxy takes the focus. They fail on a breakpoint in px too, and on a vw font size without --text-scale.

Korean text

Korean, on a Korean page or in card text marked lang="ko" on another, has its own :lang(ko) rules in style.css. Korean fonts (Apple SD Gothic Neo, Malgun Gothic, Noto Sans KR) come ahead of the Japanese ones, which hold Hangul but draw it with Japanese shapes and metrics. Fredoka and Bangers stay first for the Latin letters. Lines break between words, not syllables (word-break: keep-all). Headings, which Bangers can't draw in Korean, are bold, and neither they nor the uppercase labels are tracked apart. Code, kbd, samp and pre keep the monospace font (--font-mono) over the Korean font rule.

Arabic text

Arabic in card text marked lang="ar" has its own :lang(ar) rules in style.css. Its font is Noto Naskh Arabic, a book hand that draws the vowel marks legibly, bundled like Fredoka: only its Arabic files are fetched, and only for Arabic text. It comes after Fredoka for the Latin letters and before the systems' Arabic fonts (Geeza Pro, Segoe UI, Tahoma). Arabic letters join, so no Arabic text is tracked apart: not headings, not the card's question (tightened for Latin letters), not the uppercase labels. Headings, which Bangers can't draw in Arabic, are bold in the Arabic font, and code keeps the monospace font, as in Korean. Like any right-to-left language, Arabic runs right to left in its own isolated box (i18n.md).

German text

German, on a German page or in card text marked lang="de" on another, is hyphenated at line ends (hyphens: auto under :lang(de)), so a long compound word ("Wiederholungsintervall") breaks at a syllable, with a hyphen, not at any letter. Spanish and French need no rules of their own: Fredoka and Bangers draw their letters.