SPB Git

Repository Public MIT

DESIGN_SYSTEM.md 10.0 KB

# ORIX Astra — Design system

Source of truth: Packages/AstraDesign/Sources/ (Tokens.swift, Motion.swift, Identity.swift, Components.swift). New code takes every colour, font size, radius and animation curve from the tokens below. The 2.0 audit counted literals that predate that rule in the chat, Markdown and onboarding screens (45 paddings, 110 spacings, 10 fixed font sizes); they are listed as debt in docs/v2/TECHNICAL_DEBT.md, and the measured contrast and target-size corrections are in docs/v2/DESIGN_SYSTEM.md.

# 1. Identity

  • Name: ORIX Astra. Tagline: Every Intelligence. One Universe.
  • Glyph (AstraGlyph): a four-point star held by two tilted orbits, with one satellite. Drawn in code (StarShape, OrbitShape), so it is crisp from 16 pt to 1024 px and can be rendered monochrome.
  • App icon: generated by Scripts/make-icon.swift (Core Graphics, 1024 px, opaque, default + tinted variants): the glyph over an obsidian field with a violet and a cyan nebula wash.
  • Motifs, used sparingly:
    • Starfield: the page backdrop. Stars are placed once from a seed and drawn in a single Canvas pass; two radial washes replace any blur. It does not animate, except on the onboarding screen (12 fps twinkle, off under Reduce Motion). Under Reduce Transparency the washes are removed.
    • OrbitActivity: three dots travelling on an orbit while an answer is on its way. The only continuous animation in the app, 30 fps, visible only during generation, static under Reduce Motion.
  • Voice: plain sentences, no exclamation marks, no promises the software cannot keep. A number that was not measured or reported is shown as "—" or "unavailable".

# 2. Colour

Dynamic colours resolve per appearance and per the Increase Contrast setting (Color(light:dark:lightHC:darkHC:)).

Token Light Dark Use
background #F5F5FA #06060B Page
surface #FFFFFF #0F0F18 Cards, lists, composer
surfaceRaised #EEEEF6 #181826 Chips, secondary buttons, table headers
surfaceSunken #E8E8F2 #0A0A12 Progress tracks, reasoning block
stroke / strokeStrong #D9D9E6 / #B9B9CE #25253A / #3A3A58 Hairlines (decorative, never the only cue)
textPrimary #0B0B14 #F3F3FA Body, titles
textSecondary #45475C #A9ABC2 Supporting text
textTertiary #6A6C82 #7C7F99 Captions, placeholders
violet #6B3BEA #9B7BFF Primary accent, links, selection
indigo #4338CA #7C83FF Secondary accent
cyan #086C82 #3FD8F2 Tertiary accent, data
accentFill #6B3BEA #7446F2 Primary button fill (white text)
dangerFill #C0261F #CF2F27 Destructive and stop fills (white text)
accentSoft #ECE6FF #1D1740 User bubble, soft accent areas
success / warning / danger #0A744A / #9A5B00 / #C0261F #3DDC97 / #F6C453 / #FF7B72 Semantic text and icons
signature violet → indigo → cyan gradient same Glyph, progress bar, emphasis only

# Measured contrast (WCAG 2.x ratio, computed from the hex values)

Pair Light Dark
textPrimary on background 18.02 18.30
textSecondary on surface 9.10 8.43
textSecondary on surfaceRaised 7.88 7.76
textTertiary on surface 5.15 4.86
textTertiary on background 4.74 5.15
textPrimary on accentSoft (user bubble) 16.16 15.22
violet on surface 6.11 6.05
violet on accentSoft 5.04 5.34
indigo on accentSoft 6.52 5.24
cyan on surfaceRaised 5.23 10.28
white on accentFill 6.11 5.38
white on dangerFill 5.94 5.14
success on successSoft 5.13 8.66
warning on warningSoft 4.80 9.40
danger on dangerSoft 4.90 6.62
code keyword / string / number / comment / type on codeBackground 5.89 / 4.75 / 5.30 / 4.54 / 5.13 9.63 / 12.44 / 10.73 / 5.00 / 11.80

Every text pair is at or above 4.5:1 (AA for body text). Three pairs fell short in the first pass and were corrected before any screen shipped: light cyan (4.03 → 5.23), light success (4.44 → 5.13), and white on the dark-mode danger fill (2.52 → 5.14, by introducing dangerFill). Hairline strokes are below 3:1 on purpose: they are decoration and never the only indication of a boundary or a state.

Colour is never the only carrier of meaning: every status has a symbol and a word (badges, notices, fit verdicts).

# 3. Typography

SF Pro through Dynamic Type text styles only (AstraFont), so everything scales with the user's setting. Rounded design for display, titles and figures; default design for reading.

Token Style Use
display largeTitle, rounded, bold Onboarding headlines
title title2, rounded, semibold Screen and empty-state titles
headline headline, semibold Section titles, card titles
body / bodyEmphasis body Reading text, row titles
callout, subheadline, footnote, caption matching styles Supporting text
micro caption2, medium Badges, metric labels
mono / monoSmall monospaced callout / footnote Code, identifiers
metric / metricSmall rounded, semibold, monospaced digits Figures that update (no jitter)

The transcript reads at a base of 17 pt scaled with @ScaledMetric(relativeTo: .body); headings, code and tables derive from that one value.

# 4. Space, radius, elevation

  • Spacing scale (AstraSpace): 2, 4, 8, 12, 16, 20, 28, 40. Page margin 16. Minimum touch target 44 pt (AstraSpace.hit) on every interactive control, including icon buttons inside code blocks and message footers.
  • Radii (AstraRadius): 8, 12, 18, 24, bubble 20, pill.
  • Elevation (AstraShadow): none, low, mid, glow. Surfaces are opaque: depth comes from surface steps and hairlines, not from blur. No Material is used in scrolling content, which keeps scrolling cost flat and makes Reduce Transparency a non-event.

# 5. Motion

One motion system (AstraMotion), all springs interruptible (a new target retargets the running animation):

Token Curve Use
quick snappy 0.18 s Presses, toggles, focus ring
standard spring response 0.34, damping 0.86 Expand / collapse, composer growth, toasts
hero spring response 0.46, damping 0.82 Onboarding pages, larger moves
gentle ease-out 0.24 s Appearance of content, lock and onboarding cross-fades
reduced ease-in-out 0.15 s cross-fade Replaces all of the above under Reduce Motion

Rules:

  • Views use .astraAnimation(_:value:) or AstraMotion.resolve(_:reduceMotion:); insertions use .astraAppear(), which moves when motion is allowed and only fades otherwise.
  • Nothing animates continuously except OrbitActivity during generation and the optional onboarding twinkle.
  • Streaming text is published to the UI at most about 25 times per second; the renderer re-parses only the last Markdown block, so earlier blocks never relayout.
  • The transcript follows new content only while the reader is at the bottom (defaultScrollAnchor(.bottom, for: .sizeChanges)); scrolling up releases it and a "Jump to latest" button appears. The app never scrolls against the reader.
  • Haptics are named by intent (AstraHaptics.selection / send / tap / success / warning / error).

# 6. Components

Component Purpose
AstraCard Opaque raised surface with hairline
SectionTitle Header with optional trailing detail
AstraPrimaryButtonStyle, AstraSecondaryButtonStyle 50 pt buttons; compact secondary at 44 pt
IconButton Round icon with a full 44 pt target and a required accessibility label
AstraBadge Capsule with symbol + text, six tones
MetricTile Labelled figure; shows "—" when the value is unavailable; announces "not available" to VoiceOver
ProviderLogo Vector logo of a provider or model vendor, shown to the left of every model; SF Symbol tile fallback
NoticeCard Info / warning / error / success with optional action
EmptyStateView Glyph or symbol, title, message, actions
AstraProgressBar Determinate progress with a spoken percentage
Toast + .astraToast Transient confirmation, tap to dismiss
FlowLayout Wrapping rows of badges
Conversation: UserMessageView, AssistantMessageView, BranchSwitcher, AttachmentStrip, Composer, ContextMeter Chat surface
Rendering: MarkdownView, CodeBlockView, TableBlockView, MathBlockView Model output
Models: ModelRow, LocalModelCell, ModelPickerSheet, ProviderKeySheet, EndpointSheet Model library

# Provider and vendor logos

Logos are vector assets (App/Assets.xcassets/Logos, SVG with preserved vector data), shown at the left of every model row, picker entry, conversation row and answer header. Monochrome marks are template images that take the text colour, so they are correct in light and dark; multicolour marks are drawn as-is. Each logo is decorative for assistive technologies because the provider or model name is always present as text next to it. The marks are trademarks of their respective owners and are used only to identify the service a model comes from; this is stated in the app's About page.

# 7. Accessibility checklist applied to every screen

  • Dynamic Type: text styles only; long labels wrap or use ViewThatFits; figures use monospaced digits.
  • VoiceOver: every custom control has a label; composite rows are combined into one element; charts and meters expose a value; headers carry the header trait; decorative art is hidden.
  • Reduce Motion, Reduce Transparency, Increase Contrast: handled in the tokens and motifs, not per screen.
  • Touch targets ≥ 44 pt; one-handed reach: primary actions sit at the bottom (composer, tab bar, sheet buttons).
  • Colour is never the only signal.
  • Localisation: all user-facing strings are literals in SwiftUI views (extractable to a String Catalog); layouts do not depend on English word lengths.

Results of the manual and automated passes are recorded in docs/TEST_RESULTS.md.

Files main
Menu

Theme