design: Themes/Tokens.xaml — one place a raw value may live, guarded by DESIGN.md

Tokens.xaml carries every colour, type size, spacing step, radius and motion duration from
DESIGN.md; App.xaml merges it BEFORE Controls.xaml so styles can resolve tokens.

Guard (DesignTokensTests, 4 facts): the test PARSES DESIGN.md — the colour tables under
"## Colour" are the contract — and fails if a documented token has no brush, if the hex
disagrees, if the meter bands drift, if Tokens ever merges after Controls, or if the retired
brand red #e94560 comes back as a token. Adding a colour to the standard now requires
implementing it, and changing the theme without the document is caught.

Inter/JetBrains Mono are declared as token families with system fallbacks; the bundled font
assets are the next unit.

No surface consumes tokens yet — this unit is the foundation only.
This commit is contained in:
2026-10-30 07:43:17 -07:00
parent 565b8dbd6f
commit f2bf577f34
4 changed files with 238 additions and 17 deletions
+81
View File
@@ -0,0 +1,81 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sys="clr-namespace:System;assembly=System.Runtime">
<!-- ============================================================================
DESIGN TOKENS — the only place a raw value may live.
Source of truth: DESIGN.md (normative). Guard: ytLive.Tests/DesignTokensTests.cs,
which fails if a documented token has no brush here, or the values disagree.
Merge order: App.xaml merges this BEFORE Themes/Controls.xaml, so every style can
reference a token instead of a literal.
============================================================================ -->
<!-- Surfaces (dark navy scale) -->
<SolidColorBrush x:Key="Brush.Background" Color="#0b1326"/>
<SolidColorBrush x:Key="Brush.SurfaceContainerLowest" Color="#060e20"/>
<SolidColorBrush x:Key="Brush.SurfaceContainerLow" Color="#131b2e"/>
<SolidColorBrush x:Key="Brush.SurfaceContainer" Color="#171f33"/>
<SolidColorBrush x:Key="Brush.SurfaceContainerHigh" Color="#222a3d"/>
<SolidColorBrush x:Key="Brush.SurfaceContainerHighest" Color="#2d3449"/>
<SolidColorBrush x:Key="Brush.SurfaceBright" Color="#31394d"/>
<SolidColorBrush x:Key="Brush.Outline" Color="#334155"/>
<SolidColorBrush x:Key="Brush.OutlineVariant" Color="#1e293b"/>
<!-- Text -->
<SolidColorBrush x:Key="Brush.OnSurface" Color="#dae2fd"/>
<SolidColorBrush x:Key="Brush.OnSurfaceVariant" Color="#94a3b8"/>
<SolidColorBrush x:Key="Brush.OnSurfaceDisabled" Color="#5b6478"/>
<!-- Accent roles: one per meaning, never mixed -->
<SolidColorBrush x:Key="Brush.Tertiary" Color="#38bdf8"/>
<SolidColorBrush x:Key="Brush.OnTertiary" Color="#0b1326"/>
<SolidColorBrush x:Key="Brush.Primary" Color="#ff5451"/>
<SolidColorBrush x:Key="Brush.PrimaryContainer" Color="#b91a24"/>
<SolidColorBrush x:Key="Brush.Secondary" Color="#ffb95f"/>
<SolidColorBrush x:Key="Brush.SecondaryContainer" Color="#ee9800"/>
<SolidColorBrush x:Key="Brush.Attention" Color="#ff8c3a"/>
<SolidColorBrush x:Key="Brush.Error" Color="#ef4444"/>
<SolidColorBrush x:Key="Brush.ErrorContainer" Color="#93000a"/>
<SolidColorBrush x:Key="Brush.OnError" Color="#ffdad6"/>
<!-- Meter bands (measured levels, never gain settings) -->
<SolidColorBrush x:Key="Brush.Meter.Nominal" Color="#38bdf8"/>
<SolidColorBrush x:Key="Brush.Meter.Caution" Color="#ffb95f"/>
<SolidColorBrush x:Key="Brush.Meter.Peak" Color="#ff5451"/>
<!-- Typography. Inter/JetBrains Mono are bundled; the fallbacks keep the app correct
on a machine where the asset failed to load. -->
<FontFamily x:Key="FontFamily.Sans">Inter, Segoe UI</FontFamily>
<FontFamily x:Key="FontFamily.Mono">JetBrains Mono, Cascadia Mono, Consolas</FontFamily>
<sys:Double x:Key="FontSize.HeadlineLg">32</sys:Double>
<sys:Double x:Key="FontSize.HeadlineMd">24</sys:Double>
<sys:Double x:Key="FontSize.HeadlineSm">18</sys:Double>
<sys:Double x:Key="FontSize.BodyLg">15</sys:Double>
<sys:Double x:Key="FontSize.BodyMd">13</sys:Double>
<sys:Double x:Key="FontSize.BodySm">12</sys:Double>
<sys:Double x:Key="FontSize.LabelLg">13</sys:Double>
<sys:Double x:Key="FontSize.LabelMd">11</sys:Double>
<sys:Double x:Key="FontSize.LabelSm">10</sys:Double>
<!-- Spacing -->
<sys:Double x:Key="Space.Xs">4</sys:Double>
<sys:Double x:Key="Space.Sm">8</sys:Double>
<sys:Double x:Key="Space.Md">12</sys:Double>
<sys:Double x:Key="Space.Lg">16</sys:Double>
<sys:Double x:Key="Space.Xl">24</sys:Double>
<sys:Double x:Key="Space.Gutter">12</sys:Double>
<sys:Double x:Key="Space.Margin">16</sys:Double>
<sys:Double x:Key="Space.MarginDocked">8</sys:Double>
<!-- Shape -->
<CornerRadius x:Key="Radius.Sm">4</CornerRadius>
<CornerRadius x:Key="Radius.Md">8</CornerRadius>
<CornerRadius x:Key="Radius.Lg">16</CornerRadius>
<!-- Motion -->
<Duration x:Key="Motion.Fast">0:0:0.09</Duration>
<Duration x:Key="Motion.Normal">0:0:0.15</Duration>
</ResourceDictionary>