Bỏ qua, tới nội dung chính

Kiến trúc · ADR 0056

Slate and cobalt palette, and one full-width page container

Trạng thái
accepted. The site shell (header, footer, landing page) uses both. The other
Ngày
2026-11-23
Người quyết định
SmartLearn team (#185)

Context

The owner had two complaints. First, content sits in a narrow column with wide empty bands on both sides. Second, the colours look dated.

The width problem comes from every page choosing its own cap. A Bootstrap container sets 1320px on the shell and landing page. Other pages use max-w-5xl, 6xl or 7xl, max-w-[1600px] or max-w-[1120px]. Some do this inside a portal shell that already adds its own padding. At 1920px the landing page left 300px empty on each side. The header, a page title and a card grid could each start at a different x position (65, 105 and 161px on /blog at 1440px).

The colour problem comes from the measured template palette: navy headings (#00305c), a bright Bootstrap blue and Bootstrap greys. Several pieces were also broken:

  • the shell hard-coded raw hex, so the header stayed white in dark mode;
  • white text on the dark-theme accent was 3.4:1, which fails AA;
  • text-warning and bg-warning-soft were used in four files but never defined.

The UI review behind this decision is in docs/research/ui-review-2026-11.md.

Decision

  • Palette: cool slate neutrals and one cobalt accent. The token names stay the same, so every page picks up the new palette without a code change. Light theme: - headings ink #0f172a, body muted #3f4b5e, meta text subtle #5f6b7e (now solid, so it stays AA on tinted bands); - accent #3056d3; - status colours additional (success) #0a7f57, danger #d92d20 and a new warning #b45309. Each one has -soft and -ink variants.

Dark theme: the accent becomes #8ba6ff and on-accent flips to the dark page colour, because white on a light accent cannot pass AA. Shadows take the slate hue instead of pure black. Every text pairing is AA, and the ratios are listed in DESIGN-DNA §2.

  • New tokens: - warning, warning-soft, warning-ink; - line-field, an input border at 3:1 or more (WCAG 1.4.11; line is decorative only); - max-w-page (110rem, about 1760px, gutter included); - max-w-reading (46rem, about 70 characters); - px-gutter (clamp(1rem, 0.4rem + 2.6vw, 3rem): 16px on a phone, about 44px at 1440px, 48px from about 1600px).
  • PageContainer in @smartlearn/ui is the only horizontal frame. It lives next to the other primitives because the web app and any future app share it. - size="page" (default): full width with the gutter, capped only on very wide screens. - size="reading": the same gutter, with the text column held to max-w-reading (blog articles, long forms). - size="full": no cap, for data-dense screens.

It owns the sides only; vertical rhythm stays with Section. The old Container and the Bootstrap CONTAINER constant are deprecated. CONTAINER is removed from the shell.

  • The shell is the reference implementation. The header is sticky on the page surface (theme-aware, hairline at rest, shadow-header once scrolled). It shows inline navigation from lg, and "Trở thành giảng viên" from xl. The footer has two variants: a tinted band, or the surface-opp slab. Header, footer and landing sections share one gutter, so their left edges line up at every width.

Alternatives considered

  • Keep a fixed 1280–1440px container and only widen it. This still leaves 240px bands at 1920px and solves nothing below 1440px. The owner asked for content close to the edges.
  • No cap at all. At 2560px lines and card rows get too long to scan. 1760px is the widest setting where a four-card row still reads as a group.
  • A new hue (teal or violet) instead of cobalt. It would break the brand recognition the team already has, and a violet-blue gradient is the most common "generic AI" look. A calmer cobalt on slate modernises the palette without a rebrand.
  • New token names (primary, fg, …). Rejected: renaming would touch every file in the app for no visual gain. The values change, the names stay.

Consequences

  • Every page gets the new colours immediately. Pages that still hard-code hex or stock Tailwind colours (emerald-600, zinc-200, …) now stand out, and #186 and #187 replace them using the findings document.
  • Text on a -soft fill must use the matching -ink token. The solid status colours are only guaranteed AA on surface and surface-tint.
  • In dark mode, components that put text-white on bg-accent lose contrast. They must use text-on-accent.