health: use distinct Google-Health-style colors for sleep stages
- Commit
9b737b2fa92f999c284dd6390dd230a5ccfcf6d3- Author
- Vayun Mathur <[email protected]>
- When
- 2026-05-29 21:38 UTC (6 months ago)
- Parents
b42b398
Diff
health/src/main/java/com/vayunmathur/health/ui/components/HealthComponents.kt
diff --git a/health/src/main/java/com/vayunmathur/health/ui/components/HealthComponents.kt b/health/src/main/java/com/vayunmathur/health/ui/components/HealthComponents.ktindex 47d4f8e7b2..c1607e726d 100644--- a/health/src/main/java/com/vayunmathur/health/ui/components/HealthComponents.kt+++ b/health/src/main/java/com/vayunmathur/health/ui/components/HealthComponents.kt@@ -426,13 +426,30 @@ data class HypnogramColors( ) /**- * Theme-driven hypnogram colors. Replaces the hardcoded iOS palette- * (#FF9500/#5AC8FA/#007AFF/#5856D6) previously used in SleepDetailsPage.+ * Fixed sleep-stage colors modelled on Google Fit / Health's hypnogram.+ *+ * These are intentionally *not* theme-driven — the previous MaterialTheme+ * palette mapped every stage to a tonal variant of the same hue, which made+ * them blend together (everything looked like a shade of white in dark mode+ * and a shade of the seed color in light mode). Distinct hues across the+ * cool→warm range make each stage instantly recognizable in both modes. */-@Composable-fun hypnogramColors(): HypnogramColors = HypnogramColors(- awake = MaterialTheme.colorScheme.tertiary,- rem = MaterialTheme.colorScheme.primary,- core = MaterialTheme.colorScheme.primaryContainer,- deep = MaterialTheme.colorScheme.secondary,+val SleepStageColorAwake: Color = Color(0xFFF4B400) // Google amber — warm, stands out from sleep+val SleepStageColorRem: Color = Color(0xFF4FC3F7) // Light cyan — REM, dream sleep+val SleepStageColorCore: Color = Color(0xFF4285F4) // Google blue — light/core sleep+val SleepStageColorDeep: Color = Color(0xFF1A237E) // Deep indigo — deep sleep++private val HypnogramColorsDefault = HypnogramColors(+ awake = SleepStageColorAwake,+ rem = SleepStageColorRem,+ core = SleepStageColorCore,+ deep = SleepStageColorDeep, )++/**+ * Returns the shared [HypnogramColors] palette. Kept as a function (not a+ * direct constant import) so existing call sites — `val colors = hypnogramColors()`+ * — continue to compile unchanged.+ */+@Composable+fun hypnogramColors(): HypnogramColors = HypnogramColorsDefault