From 5034e7847514fd5ddba898eceb6e75b874c85cc5 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 1 Nov 2026 13:46:41 +0000 Subject: [PATCH] Theme: read every colour from the shared design system's GTokens PulseColors and FairyMode.Palette held their own Color(0x...) literals. They now read GTokens.kt, generated by the shared design system (gabrielbr/Gabriel-Deisgn-System, layer pulseloop, v0.2.0), so a colour changes in one place for every app. No value changes: the design system's drift.py reports 0 differences, and the screens keep reading PulseColors, so FairyMode works as before. AGENTS.md says where tokens come from now. Claude-Session: https://claude.ai/code/session_01AFTKgVttu8z9Wu34dcvEYY --- AGENTS.md | 15 +- .../java/com/pulseloop/ui/theme/FairyMode.kt | 8 +- .../java/com/pulseloop/ui/theme/GTokens.kt | 170 ++++++++++++++++++ .../com/pulseloop/ui/theme/PulseColors.kt | 94 +++++----- 4 files changed, 234 insertions(+), 53 deletions(-) create mode 100644 app/src/main/java/com/pulseloop/ui/theme/GTokens.kt diff --git a/AGENTS.md b/AGENTS.md index d6eab171..bc3d8cc3 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1177,10 +1177,17 @@ screens that no longer exist, and an app change missing from the canvas is invis board, a slot in its journey's row, a note, and a card in the flow map; a removed or renamed screen loses or renames all four. Links between boards (``) follow the app's real navigation. -- **The design system:** https://claude.ai/artifact/P1nRuiJhuffYq9pnNbHe5q — tokens from - `ui/theme/PulseColors.kt`, the Bayer dither from `ui/theme/Dither.kt`, Ubuntu Mono, and the - web components the canvas mounts. A token, colour, type size or dither coverage changed in - `ui/theme/` is changed there too, and the canvas's copy (`project/ds/pulseloop/`) is refreshed. +- **The design system's source of truth is a repo:** + [gabrielbr/Gabriel-Deisgn-System](https://github.com/gabrielbr/Gabriel-Deisgn-System), shared + with GVoice/GMind and audited on every change. Its `pulseloop` layer generates + `ui/theme/GTokens.kt`, and `PulseColors` / `FairyMode.Palette` read every colour from it: no + `Color(0x…)` literals there. A token, colour, type size or dither value changes in that repo + first; then copy the generated `GTokens.kt` in and run its + `scripts/drift.py --pulseloop ` until it reports 0 differences. +- **The design-system artifact:** https://claude.ai/artifact/P1nRuiJhuffYq9pnNbHe5q — the tokens + above, the Bayer dither from `ui/theme/Dither.kt`, Ubuntu Mono, and the web components the + canvas mounts. A token changed in the repo is changed there too, and the canvas's copy + (`project/ds/pulseloop/`) is refreshed. - **Design → app:** an annotation or design edit the owner agrees to is implemented in Compose, released through the normal flow, and only then reported as done. - **Read before writing.** The owner edits the canvas by hand; read the boards you will change diff --git a/app/src/main/java/com/pulseloop/ui/theme/FairyMode.kt b/app/src/main/java/com/pulseloop/ui/theme/FairyMode.kt index b366f219..01610828 100644 --- a/app/src/main/java/com/pulseloop/ui/theme/FairyMode.kt +++ b/app/src/main/java/com/pulseloop/ui/theme/FairyMode.kt @@ -64,10 +64,10 @@ object FairyMode { /** Her palette: a soft rose pink with deep plum ink on it (7.7:1). */ object Palette { - val accent = Color(0xFFFF8FC7) - val accentSoft = Color(0x2EFF8FC7) - val onAccent = Color(0xFF3D0A26) - val rem = Color(0xFFFFB3DA) + val accent = GTokens.Colors.fairyAccent + val accentSoft = GTokens.Colors.fairyAccentSoft + val onAccent = GTokens.Colors.fairyOnAccent + val rem = GTokens.Colors.fairyRem /** Sparkle colours: pinks, a little gold and white. */ val sparkles = listOf( Color(0xFFFF8FC7), Color(0xFFFFB3DA), Color(0xFFFF5FA8), Color(0xFFFFD6EC), diff --git a/app/src/main/java/com/pulseloop/ui/theme/GTokens.kt b/app/src/main/java/com/pulseloop/ui/theme/GTokens.kt new file mode 100644 index 00000000..3c68a574 --- /dev/null +++ b/app/src/main/java/com/pulseloop/ui/theme/GTokens.kt @@ -0,0 +1,170 @@ +// GENERATED by Gabriel-Design-System scripts/gen_tokens.py from tokens/tokens.json v0.2.0 — do not edit. +package com.pulseloop.ui.theme + +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.unit.dp + +/** + * Gabriel Design System values for PulseLoop (dark only). PulseColors, PulseType and Motion alias + * these; a screen reads PulseColors, never this object directly, so FairyMode keeps working. + */ +object GTokens { + object Colors { + /** Screen background inside the mint frame. */ + val page = Color(0xFF121214) + /** Header, tab bar, fields, cards, sheets. */ + val surface = Color(0xFF1C1B1F) + /** Text, icons, secondary buttons, the recorder panel in light. */ + val ink = Color(0xFFF2F2F2) + /** Meta text, captions, row values. 5.9:1 on page in light. */ + val muted = Color(0xFFA8A7AD) + /** Hairlines under rows, field and chip borders. Never for text. */ + val line = Color(0xFF2C2B30) + /** The one primary action per screen, the title highlighter, the active tab pill, progress chips, the 4dp frame. Text on it is ink. */ + val mint = Color(0xFF43F3B7) + /** Small text on a mint fill (chips). 9:1 on mint. */ + val onMint = Color(0xFF033423) + /** Stop button fill and the recording dot. Text and icons on it use on-coral. */ + val coral = Color(0xFFFF7A70) + /** Alert text, destructive button text and outline, on page, surface or coral-soft. */ + val coralText = Color(0xFFFF9A92) + /** Tint behind coral-text chips (Interrupted, Needs attention) so 12px text passes 4.5:1. */ + val coralSoft = Color(0xFF3A1A17) + /** Material surface behind cards (secondaryBackground). */ + val pageRaised = Color(0xFF161619) + /** A card inside a card, pressed rows. */ + val surfaceSoft = Color(0xFF242328) + /** Highest container (surfaceContainerHighest). */ + val surfaceElevated = Color(0xFF2C2B30) + /** Tertiary text. 5.2:1 on surface, 4.75:1 on surface-soft; do not lighten. */ + val muted2 = Color(0xFF8E8D94) + /** Outlines that must read as a boundary. */ + val lineStrong = Color(0xFF3D3C42) + /** Mint at 18%: primaryContainer. Prefer the dither over this wash. */ + val mintSoft = Color(0x2E43F3B7) + /** Good, in range, done, connected. Its own green: mint means 'tap here'. */ + val success = Color(0xFF4CC97A) + /** Watch, borderline, connecting. */ + val warning = Color(0xFFFFC46B) + /** Neutral information. */ + val info = Color(0xFF5AD8F0) + /** Steps. Leaf green, distinct from mint. */ + val metricSteps = Color(0xFF9BEA6B) + /** Heart rate. */ + val metricHeartRate = Color(0xFFFF7A70) + /** Blood oxygen. */ + val metricSpo2 = Color(0xFF5AD8F0) + /** Sleep. */ + val metricSleep = Color(0xFF9A8CFF) + /** Calories. */ + val metricCalories = Color(0xFFFF9A5C) + /** Distance. */ + val metricDistance = Color(0xFF5BA8FF) + /** Ring battery. */ + val metricBattery = Color(0xFFA7F3D0) + /** Stress. */ + val metricStress = Color(0xFFFF9A5C) + /** Heart-rate variability. */ + val metricHrv = Color(0xFFB59CFF) + /** Skin temperature. */ + val metricTemperature = Color(0xFF3FD0C8) + /** Blood pressure. */ + val metricBloodPressure = Color(0xFFFF7FA8) + /** Blood glucose. */ + val metricBloodSugar = Color(0xFFFFC46B) + /** Fatigue. */ + val metricFatigue = Color(0xFFC98CFF) + /** Drinks. Wine rose. */ + val metricDrinks = Color(0xFFE38FB5) + /** Below the normal range. */ + val zoneLow = Color(0xFF5BA8FF) + /** In range. Same as success. */ + val zoneGood = Color(0xFF4CC97A) + /** Normal, acceptable. */ + val zoneNormal = Color(0xFF5AD8F0) + /** Borderline, watch. */ + val zoneBorderline = Color(0xFFFFC46B) + /** Soft amber step. */ + val zoneBorderlineSoft = Color(0xFFFFDDA6) + /** Elevated, stage 1. */ + val zoneElevated = Color(0xFFFF9A5C) + /** High, concerning. */ + val zoneHigh = Color(0xFFFF7A70) + /** Critical. */ + val zoneCritical = Color(0xFFFF4B3E) + /** Deep sleep. 3.3:1 on surface (graphic, not text). */ + val stageDeep = Color(0xFF6352F0) + /** Light sleep. */ + val stageLight = Color(0xFF9A8CFF) + /** REM. Cyan, not mint, so it doesn't read as 'tap here'. */ + val stageRem = Color(0xFF5AD8F0) + /** Awake. */ + val stageAwake = Color(0xFFFFC46B) + /** Fairy mode (a private easter egg): replaces mint. */ + val fairyAccent = Color(0xFFFF8FC7) + /** Fairy mode: replaces mint-soft. */ + val fairyAccentSoft = Color(0x2EFF8FC7) + /** Fairy mode: replaces on-mint. 7.9:1. */ + val fairyOnAccent = Color(0xFF3D0A26) + /** Fairy mode: replaces stage-rem. */ + val fairyRem = Color(0xFFFFB3DA) + } + + object Spacing { + val space1 = 4.dp + val space2 = 8.dp + val space3 = 12.dp + val space4 = 16.dp + val space6 = 24.dp + val space8 = 32.dp + val space10 = 40.dp + val space12 = 48.dp + val space16 = 64.dp + } + + object Radius { + val radiusS = 4.dp + val radiusM = 8.dp + val radiusL = 16.dp + val radiusRound = 999.dp + } + + object Size { + val frame = 4.dp + val hairline = 1.dp + val contentMax = 720.dp + } + + /** Durations in ms. */ + object Motion { + const val motionStandard = 150 + const val motionEmphasised = 250 + const val motionFill = 900 + const val motionScreen = 750 + } + + /** Font sizes in sp, line heights in em. */ + object Type { + val scale = listOf(12, 14, 16, 20, 24, 28, 32, 40) + const val eyebrowSize = 12 + const val eyebrowLineEm = 1.3f + const val eyebrowWeight = 500 + const val labelSize = 12 + const val labelLineEm = 1.3f + const val labelWeight = 400 + const val bodySize = 14 + const val bodyLineEm = 1.4f + const val bodyWeight = 400 + const val titleSize = 16 + const val titleLineEm = 1.3f + const val titleWeight = 700 + const val headlineSize = 28 + const val headlineLineEm = 1.2f + const val headlineWeight = 700 + } + + object Dither { + val bayer4 = intArrayOf(0, 8, 2, 10, 12, 4, 14, 6, 3, 11, 1, 9, 15, 7, 13, 5) + const val steps = 16 + } +} diff --git a/app/src/main/java/com/pulseloop/ui/theme/PulseColors.kt b/app/src/main/java/com/pulseloop/ui/theme/PulseColors.kt index 4aabdd89..75c9d650 100644 --- a/app/src/main/java/com/pulseloop/ui/theme/PulseColors.kt +++ b/app/src/main/java/com/pulseloop/ui/theme/PulseColors.kt @@ -7,74 +7,78 @@ import androidx.compose.ui.graphics.Color * `ui-kit` UiTokens): page #121214, surface #1C1B1F, ink #F2F2F2, muted #A8A7AD, hairline * #2C2B30, and mint #43F3B7 as the one accent, with ink-green #033423 for text on it. The * metric, zone and stage colours are tuned to sit beside the mint rather than compete with - * it. The zone hexes below are the single source of truth that [MetricColors] and - * ZonePalette alias. + * it. [MetricColors] and ZonePalette alias the zone colours below. + * + * Every value comes from [GTokens], generated by the shared design system + * (github.com/gabrielbr/Gabriel-Deisgn-System, layer `pulseloop`). Change a colour there, then copy + * the new GTokens.kt in; never write a Color(0x…) literal here. Screens keep reading PulseColors, + * so FairyMode's getters keep working. */ object PulseColors { /** GMind mint. The brand colours below are getters so [FairyMode] can turn them pink. */ - private val MINT = Color(0xFF43F3B7) - val background = Color(0xFF121214) - val secondaryBackground = Color(0xFF161619) - val card = Color(0xFF1C1B1F) - val cardSoft = Color(0xFF242328) - val elevated = Color(0xFF2C2B30) - val textPrimary = Color(0xFFF2F2F2) - val textSecondary = Color(0xFFA8A7AD) + private val MINT = GTokens.Colors.mint + val background = GTokens.Colors.page + val secondaryBackground = GTokens.Colors.pageRaised + val card = GTokens.Colors.surface + val cardSoft = GTokens.Colors.surfaceSoft + val elevated = GTokens.Colors.surfaceElevated + val textPrimary = GTokens.Colors.ink + val textSecondary = GTokens.Colors.muted /** Tertiary text. #8E8D94 so it still reads at 4.5:1 on [card] and [cardSoft] (#7C7B82 was 4.1 / 3.7). */ - val textMuted = Color(0xFF8E8D94) + val textMuted = GTokens.Colors.muted2 /** GMind mint: the primary action, the selected state, the screen frame. */ val accent: Color get() = if (FairyMode.on) FairyMode.Palette.accent else MINT - val accentSoft: Color get() = if (FairyMode.on) FairyMode.Palette.accentSoft else Color(0x2E43F3B7) // accent @ 18% + val accentSoft: Color get() = if (FairyMode.on) FairyMode.Palette.accentSoft else GTokens.Colors.mintSoft // accent @ 18% /** Text and icons on a mint fill (GMind ON_MINT, 9:1 on mint). Never white on mint. */ - val onAccent: Color get() = if (FairyMode.on) FairyMode.Palette.onAccent else Color(0xFF033423) + val onAccent: Color get() = if (FairyMode.on) FairyMode.Palette.onAccent else GTokens.Colors.onMint /** * "Good / in range / done". Its own green, not the mint: mint is the brand and the thing * to tap, and when it also meant success, connected and REM it stopped saying "act here". */ - val success = Color(0xFF4CC97A) - val warning = Color(0xFFFFC46B) - val danger = Color(0xFFFF7A70) // GMind coral (dark) - val info = Color(0xFF5AD8F0) + val success = GTokens.Colors.success + val warning = GTokens.Colors.warning + val danger = GTokens.Colors.coral // GMind coral (dark) + val info = GTokens.Colors.info // Per-metric accents - val steps = Color(0xFF9BEA6B) // leaf green, distinct from the mint accent - val heartRate = Color(0xFFFF7A70) // coral - val spo2 = Color(0xFF5AD8F0) - val sleep = Color(0xFF9A8CFF) - val calories = Color(0xFFFF9A5C) - val distance = Color(0xFF5BA8FF) - val battery = Color(0xFFA7F3D0) - val stress = Color(0xFFFF9A5C) - val hrv = Color(0xFFB59CFF) - val temperature = Color(0xFF3FD0C8) - val bloodPressure = Color(0xFFFF7FA8) - val bloodSugar = Color(0xFFFFC46B) - val fatigue = Color(0xFFC98CFF) - val drinks = Color(0xFFE38FB5) // wine rose + val steps = GTokens.Colors.metricSteps // leaf green, distinct from the mint accent + val heartRate = GTokens.Colors.metricHeartRate // coral + val spo2 = GTokens.Colors.metricSpo2 + val sleep = GTokens.Colors.metricSleep + val calories = GTokens.Colors.metricCalories + val distance = GTokens.Colors.metricDistance + val battery = GTokens.Colors.metricBattery + val stress = GTokens.Colors.metricStress + val hrv = GTokens.Colors.metricHrv + val temperature = GTokens.Colors.metricTemperature + val bloodPressure = GTokens.Colors.metricBloodPressure + val bloodSugar = GTokens.Colors.metricBloodSugar + val fatigue = GTokens.Colors.metricFatigue + val drinks = GTokens.Colors.metricDrinks // wine rose val readiness: Color get() = accent // the headline score wears the brand colour // Vitals reference-zone colors (AppTheme.swift zone*) — aliased by // ZonePalette (fine iOS-parity palette) and [MetricColors] (coarse semantic palette) - val zoneBlue = Color(0xFF5BA8FF) + val zoneBlue = GTokens.Colors.zoneLow /** The in-range zone. Named for its old mint; it is the [success] green now. */ - val zoneMint = Color(0xFF4CC97A) - val zoneCyan = Color(0xFF5AD8F0) - val zoneAmber = Color(0xFFFFC46B) - val zoneSoftAmber = Color(0xFFFFDDA6) - val zoneOrange = Color(0xFFFF9A5C) - val zoneRed = Color(0xFFFF7A70) - val zoneCritical = Color(0xFFFF4B3E) + val zoneMint = GTokens.Colors.zoneGood + val zoneCyan = GTokens.Colors.zoneNormal + val zoneAmber = GTokens.Colors.zoneBorderline + val zoneSoftAmber = GTokens.Colors.zoneBorderlineSoft + val zoneOrange = GTokens.Colors.zoneElevated + val zoneRed = GTokens.Colors.zoneHigh + val zoneCritical = GTokens.Colors.zoneCritical // Sleep stage colors (DesignSystem/Charts.swift SleepStageColors) /** 3.3:1 on [card]: deep is the stage people look for, and #4B3BD6 was 2.4:1. */ - val stageDeep = Color(0xFF6352F0) - val stageLight = Color(0xFF9A8CFF) + val stageDeep = GTokens.Colors.stageDeep + val stageLight = GTokens.Colors.stageLight /** Cyan rather than the brand mint, so REM doesn't read as "tap here" (see [success]). */ - val stageRem: Color get() = if (FairyMode.on) FairyMode.Palette.rem else Color(0xFF5AD8F0) - val stageAwake = Color(0xFFFFC46B) + val stageRem: Color get() = if (FairyMode.on) FairyMode.Palette.rem else GTokens.Colors.stageRem + val stageAwake = GTokens.Colors.stageAwake - val borderSubtle = Color(0xFF2C2B30) // GMind hairline (LINE, dark) - val borderStrong = Color(0xFF3D3C42) + val borderSubtle = GTokens.Colors.line // GMind hairline (LINE, dark) + val borderStrong = GTokens.Colors.lineStrong /** The GMind frame: a 4dp mint border round every screen. */ val frame: Color get() = accent