Files
stemengine_old/20260317_WebUI_Skins_Phase1_Implementation.md
T
2026-03-17 15:27:42 +09:00

2.5 KiB

2026-03-17 — WebUI Skins Phase 1 Implementation

Scope implemented

Phase 1 from the skins plan is now implemented:

  1. Skin/readability state management and persistence.
  2. CSS data-attribute foundation (data-skin, data-readability) with semantic UI tokens.
  3. Settings UI controls for selecting skin and readability profile.
  4. Non-breaking integration with existing theme/accent/font behavior.

Files changed

  • frontend/src/utils/appearance.ts
  • frontend/src/App.tsx
  • frontend/src/pages/Settings.tsx
  • frontend/src/index.css

What changed

1) Appearance utilities

Added new exported options and helpers:

  • SKIN_OPTIONS
  • READABILITY_OPTIONS
  • applySkin()
  • applyReadability()
  • applySavedAppearance()

Also added dyslexia-friendly font support:

  • atkinson font entry (Atkinson Hyperlegible) in FONT_OPTIONS and lazy loader map.

Persistence keys:

  • stemengine-skin
  • stemengine-readability

2) App initialization

App.tsx now calls applySavedAppearance() on startup.

Result: saved font, accent, skin, and readability all re-apply on reload.

3) Settings UI (Appearance tab)

Added two new control groups:

  • Skin
  • Readability Profile

Behavior:

  • Selecting readability = dyslexia applies dataset mode immediately.
  • If readability switches to dyslexia while font is still system, UI auto-switches to atkinson to improve readability by default.

4) CSS foundation in index.css

Added semantic tokens and presets:

  • Base semantic tokens: --ui-bg, --ui-surface, --ui-text, --ui-border, etc.
  • Skin selectors:
    • [data-skin="studio-dark"]
    • [data-skin="high-contrast"]
    • [data-skin="paper-light"]
    • [data-skin="dyslexia-friendly"]
  • Readability selector:
    • [data-readability="dyslexia"]

Added typography variables to body:

  • --ui-font-size
  • --ui-line-height
  • --ui-letter-spacing
  • --ui-word-spacing

This establishes the token layer without forcing a full component migration yet.

Out of scope (next phases)

  • Full component migration from static slate/gray utility colors to semantic token-driven classes.
  • Contrast-focused QA matrix for every major page in every skin.
  • Preview card and reset button UX enhancements in Appearance settings.

Validation notes

  • Existing light/dark/system behavior remains handled by ThemeContext.
  • Existing accent behavior remains unchanged.
  • Existing font selection behavior remains unchanged (plus Atkinson option).
  • New settings persist through localStorage and re-apply on load.