diff --git a/frontend/src/index.css b/frontend/src/index.css
index a64712a..468df31 100644
--- a/frontend/src/index.css
+++ b/frontend/src/index.css
@@ -26,10 +26,12 @@
--surface-3: #3a3a3c; /* controls (segmented track, switch off) */
/* The translucent card fill. Deliberately a warm near-black rather than the neutral --surface:
these cards sit on the aura, and a cool grey over a warm background reads as a dirty edge. */
- /* 34%, not 55%: at 55 the fill was technically translucent and visually identical to opaque —
- a dark film over a dark background reads as solid, and that is what people saw. This is the one
- number to turn if the cards should show more or less of the aura behind them. */
- --glass: rgba(20,18,16,.34);
+ /* Two levels of the same idea, and both were tuned by watching them rather than by taste: at 55%
+ a dark film over a dark background is technically translucent and visually solid, which is what
+ people saw. `--glass` is the panels — cards, tiles, grouped lists — and `--glass-strong` is the
+ things that float over content and have to be read through: the tab bar and the sheets. */
+ --glass: rgba(20,18,16,.38);
+ --glass-strong: rgba(18,16,14,.72);
/* text */
--label: #ffffff;
@@ -73,7 +75,8 @@
--surface: #ffffff;
--surface-2: #ececef;
--surface-3: #e3e3e8;
- --glass: rgba(255,255,255,.44);
+ --glass: rgba(255,255,255,.58);
+ --glass-strong: rgba(255,255,255,.82);
--label: #000000;
--label-2: rgba(60,60,67,.60);
@@ -300,18 +303,27 @@ h4.sec{
/* ----------------------------------------------------------------- card -- */
.card{
- background:var(--surface);border-radius:var(--r-card);
+ background:var(--glass);border-radius:var(--r-card);
padding:16px;margin-bottom:12px;
}
.card .big{font-size:30px;font-weight:600;letter-spacing:-.026em;line-height:1.1}
+/* Every panel gets the blur from this one rule instead of each class carrying its own pair: the
+ backgrounds above are translucent now, and what is behind them is the aura (index.html), which is
+ soft enough that losing the blur costs nothing — hence no opaque fallback here, unlike the tab
+ bar, which floats over scrolling text and keeps one. The Salud cards declare their own because
+ they add a per-metric tint on top; being later in the file, theirs wins. */
+.card,.tile,.sect-b,.item,.exnote,.efftbl,.ss-card,.ci-card,.cal-d{
+ -webkit-backdrop-filter:blur(14px) saturate(150%);backdrop-filter:blur(14px) saturate(150%);
+}
+
/* ------------------------------------------------------ inset group list -- */
.sect{margin-bottom:22px}
.sect-t{
font-size:13px;font-weight:400;color:var(--label-2);
letter-spacing:-.004em;padding:0 4px 7px;display:block;
}
-.sect-b{background:var(--surface);border-radius:var(--r-card);overflow:hidden}
+.sect-b{background:var(--glass);border-radius:var(--r-card);overflow:hidden}
.sect-f{font-size:13px;color:var(--label-2);padding:7px 4px 0;line-height:1.38}
.lrow{
@@ -398,7 +410,7 @@ h4.sec{
/* ----------------------------------------------------------- tab bar ----- */
/* Nearly opaque, and deliberately so. At the old 72% the page read straight through the bar
and the labels had to compete with whatever was scrolling behind them — nobody needs to read
- the content under a navigation bar. 94% keeps a hint of movement behind the glass without
+ the content under a navigation bar. --glass-strong keeps a hint of movement behind it without
letting text through. The blur is also down from 24px to 10px: this is a fixed element, so
the WebView recomposites the blurred region on every scroll frame, and on Android that is
the single most expensive thing on the screen. See @supports below for the no-blur case. */
@@ -406,11 +418,11 @@ h4.sec{
position:fixed;left:0;right:0;bottom:0;z-index:50;
display:flex;justify-content:space-around;align-items:flex-end;
padding:7px 6px calc(6px + var(--sab));
- background:color-mix(in srgb,var(--bg-el) 94%,transparent);
+ background:var(--glass-strong);
-webkit-backdrop-filter:saturate(180%) blur(10px);backdrop-filter:saturate(180%) blur(10px);
border-top:var(--hair) solid var(--sep-op);
}
-:root[data-theme="light"] #tabbar{background:rgba(249,249,251,.94)}
+:root[data-theme="light"] #tabbar{background:var(--glass-strong)}
#tabbar button{
flex:1;display:flex;flex-direction:column;align-items:center;gap:3px;
color:var(--label-3);font-size:10px;font-weight:500;letter-spacing:.005em;padding-top:3px;
@@ -498,7 +510,7 @@ h4.sec{
/* ----------------------------------------------------------------- list -- */
.list{display:flex;flex-direction:column;gap:8px}
.item{
- display:flex;align-items:center;gap:12px;background:var(--surface);
+ display:flex;align-items:center;gap:12px;background:var(--glass);
border-radius:var(--r-card);padding:10px 12px;min-height:60px;
transition:background var(--fast);text-align:left;width:100%;
}
@@ -588,7 +600,7 @@ body.chips-dragging *{cursor:inherit}
.field:focus,.input:focus{box-shadow:inset 0 0 0 2px var(--acc)}
.field.area,textarea.input{min-height:92px;resize:vertical;line-height:1.42}
.exnote{
- background:var(--surface);border-radius:var(--r);padding:13px 15px;
+ background:var(--glass);border-radius:var(--r);padding:13px 15px;
line-height:1.45;white-space:pre-wrap;font-size:15px;margin-bottom:10px;color:var(--label-2);
}
@@ -1138,7 +1150,7 @@ body.chips-dragging *{cursor:inherit}
touch-action:none;overscroll-behavior:none;
}
.sheet{
- position:absolute;left:0;right:0;bottom:0;background:var(--bg-el);
+ position:absolute;left:0;right:0;bottom:0;background:var(--glass-strong);
border-radius:var(--r-xl) var(--r-xl) 0 0;
padding:8px 18px calc(20px + var(--sab));
/* A tall sheet stops short of the status bar / Dynamic Island: every cap carries the top
@@ -1178,7 +1190,7 @@ body.chips-dragging *{cursor:inherit}
tabular columns you can read straight down, and the words take whatever is left. Built out
of the same grouped-list parts as the rest of the app (surface fill, inset hairlines) rather
than a real
, so it inherits the card look and wraps properly on a narrow phone. */
-.efftbl{background:var(--surface);border-radius:var(--r-lg);overflow:hidden;margin:14px 0 12px}
+.efftbl{background:var(--glass);border-radius:var(--r-lg);overflow:hidden;margin:14px 0 12px}
.efftbl .r{display:flex;align-items:center;gap:10px;padding:10px 14px;position:relative}
.efftbl .r+.r::before{
content:'';position:absolute;left:14px;right:0;top:0;height:var(--hair);background:var(--sep);
@@ -1321,7 +1333,7 @@ body.chips-dragging *{cursor:inherit}
/* --- stat tiles --- */
.tiles{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-bottom:12px}
-.tile{background:var(--surface);border-radius:var(--r-card);padding:14px}
+.tile{background:var(--glass);border-radius:var(--r-card);padding:14px}
.tile .l{
color:var(--label-2);font-size:13px;font-weight:400;letter-spacing:-.004em;
text-transform:none;display:flex;align-items:center;gap:5px;
@@ -1344,6 +1356,7 @@ body.chips-dragging *{cursor:inherit}
background:color-mix(in srgb,var(--tint) 14%,var(--glass));
border:var(--hair) solid color-mix(in srgb,var(--tint) 26%,transparent);
-webkit-backdrop-filter:blur(10px) saturate(140%);backdrop-filter:blur(10px) saturate(140%)}
+.vh-card .l{color:var(--tint)}
.vh-card .l .icn{color:var(--tint)}
.vh-card .v{color:var(--tint)}
.vh-unit{margin-left:4px;font-size:14px;font-weight:500;color:var(--label-2);letter-spacing:0}
@@ -1430,7 +1443,7 @@ body.chips-dragging *{cursor:inherit}
.cal-grid{display:grid;grid-template-columns:repeat(7,1fr);gap:5px;margin-top:10px}
.cal-h{text-align:center;font-size:11px;color:var(--label-3);font-weight:500;text-transform:uppercase;padding:2px 0}
.cal-d{
- aspect-ratio:1;border-radius:10px;background:var(--surface);
+ aspect-ratio:1;border-radius:10px;background:var(--glass);
display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;
font-weight:400;font-size:15px;color:var(--label);transition:background var(--fast);
}
@@ -1459,7 +1472,7 @@ body.chips-dragging *{cursor:inherit}
.item.in-ss{box-shadow:inset 3px 0 0 var(--acc)}
.ss-card{
border-radius:var(--r-lg);padding:14px;
- background:var(--surface);box-shadow:inset 0 0 0 1.5px var(--acc-line);
+ background:var(--glass);box-shadow:inset 0 0 0 1.5px var(--acc-line);
}
.workout-swipe-surface{touch-action:pan-y}
/* A superset nests a card inside the page's own gutter, so its inset is paid twice. On a
@@ -1575,7 +1588,7 @@ body.chips-dragging *{cursor:inherit}
.ci-rail::-webkit-scrollbar{display:none}
.ci-card{
scroll-snap-align:center;flex:0 0 100%;box-sizing:border-box;
- background:var(--surface);border-radius:var(--r-xl);padding:22px 18px;
+ background:var(--glass);border-radius:var(--r-xl);padding:22px 18px;
display:flex;flex-direction:column;align-items:center;gap:14px;
transition:transform var(--fast),box-shadow var(--fast),opacity var(--fast);
}
diff --git a/frontend/src/lib/vitals-view.js b/frontend/src/lib/vitals-view.js
index 2ecd537..010966d 100644
--- a/frontend/src/lib/vitals-view.js
+++ b/frontend/src/lib/vitals-view.js
@@ -20,14 +20,18 @@ const GROUP_LABEL = {
activity: 'Activity', heart: 'Heart', body: 'Body', sleep: 'Sleep', vitals: 'Vitals', other: 'Other'
}
-/* One colour per family, so a glance tells you what kind of number you are looking at — the same
- job the group heading does, but readable while scrolling past. The tints come from the app's
- own palette variables rather than fixed hex values: the light theme redefines every one of them
- (`:root[data-theme="light"]` in index.css), so a card stays legible in both.
+/* Colours, in two layers.
*
- * Deliberately NOT `var(--acc)`: the accent is whatever the person picked in Settings, and a
- * dashboard whose "steps" colour changes with the theme accent is a dashboard nobody can learn.
- * Grey for `other` matches the group's meaning — an unrecognised metric has no family to colour.
+ * Each metric in the catalogue carries its own (`color:` in its spec below), which is what the
+ * Health app does and what makes a wall of numbers readable: resting heart rate and VO₂ max are
+ * both "heart", and telling them apart by colour is the point. `GROUP_TINT` is the fallback — the
+ * family colour for a metric nobody has written a line for yet, so an unknown metric is grey
+ * rather than colourless.
+ *
+ * They are the app's own palette variables rather than fixed hex: the light theme redefines every
+ * one of them (`:root[data-theme="light"]` in index.css), so a card stays legible in both. And
+ * deliberately not `var(--acc)`: the accent is whatever the person picked in Settings, and a
+ * dashboard whose "steps" colour changes with the theme accent is one nobody can learn.
*/
export const GROUP_TINT = {
activity: 'var(--green)',
@@ -49,7 +53,11 @@ const spec = (label, group, o = {}) => ({
unit: o.unit || '',
icon: o.icon || 'dot',
dec: o.dec == null ? 0 : o.dec,
- better: o.better || null // 'down' for resting heart rate, 'up' for VO2 max, null = neutral
+ better: o.better || null, // 'down' for resting heart rate, 'up' for VO2 max, null = neutral
+ // Its own colour, or null to fall back to the family's (see GROUP_TINT). Named here because this
+ // builder is an allow-list: a field the caller passes and this does not copy simply disappears,
+ // which is exactly how the per-metric colours were briefly invisible.
+ color: o.color || null
})
/* The catalogue. Names are HAE's snake_case metric keys as they appear in the JSON export
@@ -57,64 +65,64 @@ const spec = (label, group, o = {}) => ({
humanized, in 'Other' — so an export of everything stays useful the day it arrives. */
export const METRICS = {
// — activity —
- step_count: spec('Steps', 'activity', { unit: 'steps', icon: 'figureRun' }),
- distance_walking_running: spec('Distance', 'activity', { unit: 'km', dec: 2, icon: 'figureRun' }),
- walking_running_distance: spec('Distance', 'activity', { unit: 'km', dec: 2, icon: 'figureRun' }),
- flights_climbed: spec('Flights climbed', 'activity', { unit: 'flights', icon: 'arrowUp' }),
- apple_exercise_time: spec('Exercise time', 'activity', { unit: 'min', icon: 'timer' }),
- apple_stand_time: spec('Stand time', 'activity', { unit: 'min', icon: 'clock' }),
- apple_stand_hour: spec('Stand hours', 'activity', { unit: 'h', icon: 'clock' }),
- active_energy: spec('Active energy', 'activity', { unit: 'kcal', icon: 'flame', better: 'up' }),
- basal_energy_burned: spec('Resting energy', 'activity', { unit: 'kcal', icon: 'flame' }),
- physical_effort: spec('Physical effort', 'activity', { unit: '', dec: 1, agg: 'avg', icon: 'bolt' }),
- time_in_daylight: spec('Time in daylight', 'activity', { unit: 'min', icon: 'sun' }),
- mindful_minutes: spec('Mindful minutes', 'activity', { unit: 'min', icon: 'moon' }),
+ step_count: spec('Steps', 'activity', { color: 'var(--orange)', unit: 'steps', icon: 'figureRun' }),
+ distance_walking_running: spec('Distance', 'activity', { color: 'var(--green)', unit: 'km', dec: 2, icon: 'figureRun' }),
+ walking_running_distance: spec('Distance', 'activity', { color: 'var(--green)', unit: 'km', dec: 2, icon: 'figureRun' }),
+ flights_climbed: spec('Flights climbed', 'activity', { color: 'var(--mint)', unit: 'flights', icon: 'arrowUp' }),
+ apple_exercise_time: spec('Exercise time', 'activity', { color: 'var(--yellow)', unit: 'min', icon: 'timer' }),
+ apple_stand_time: spec('Stand time', 'activity', { color: 'var(--teal)', unit: 'min', icon: 'clock' }),
+ apple_stand_hour: spec('Stand hours', 'activity', { color: 'var(--teal)', unit: 'h', icon: 'clock' }),
+ active_energy: spec('Active energy', 'activity', { color: 'var(--red)', unit: 'kcal', icon: 'flame', better: 'up' }),
+ basal_energy_burned: spec('Resting energy', 'activity', { color: 'var(--pink)', unit: 'kcal', icon: 'flame' }),
+ physical_effort: spec('Physical effort', 'activity', { color: 'var(--orange)', unit: '', dec: 1, agg: 'avg', icon: 'bolt' }),
+ time_in_daylight: spec('Time in daylight', 'activity', { color: 'var(--yellow)', unit: 'min', icon: 'sun' }),
+ mindful_minutes: spec('Mindful minutes', 'activity', { color: 'var(--indigo)', unit: 'min', icon: 'moon' }),
// — heart —
- heart_rate: spec('Heart rate', 'heart', { field: 'Avg', agg: 'avg', unit: 'bpm', icon: 'heart' }),
- resting_heart_rate: spec('Resting heart rate', 'heart', { agg: 'avg', unit: 'bpm', icon: 'heart', better: 'down' }),
- walking_heart_rate_average: spec('Walking heart rate', 'heart', { agg: 'avg', unit: 'bpm', icon: 'heart', better: 'down' }),
- heart_rate_variability: spec('Heart rate variability', 'heart', { agg: 'avg', unit: 'ms', icon: 'bolt', better: 'up' }),
- heart_rate_recovery_one_minute: spec('Heart rate recovery', 'heart', { agg: 'avg', unit: 'bpm', icon: 'reset', better: 'up' }),
- vo2_max: spec('VO₂ max', 'heart', { dec: 1, icon: 'rocket', better: 'up' }),
- cardio_recovery: spec('Cardio recovery', 'heart', { agg: 'avg', unit: 'bpm', icon: 'reset', better: 'up' }),
- atrial_fibrillation_burden: spec('AFib burden', 'heart', { agg: 'avg', unit: '%', dec: 1, icon: 'warning', better: 'down' }),
+ heart_rate: spec('Heart rate', 'heart', { color: 'var(--red)', field: 'Avg', agg: 'avg', unit: 'bpm', icon: 'heart' }),
+ resting_heart_rate: spec('Resting heart rate', 'heart', { color: 'var(--pink)', agg: 'avg', unit: 'bpm', icon: 'heart', better: 'down' }),
+ walking_heart_rate_average: spec('Walking heart rate', 'heart', { color: 'var(--purple)', agg: 'avg', unit: 'bpm', icon: 'heart', better: 'down' }),
+ heart_rate_variability: spec('Heart rate variability', 'heart', { color: 'var(--teal)', agg: 'avg', unit: 'ms', icon: 'bolt', better: 'up' }),
+ heart_rate_recovery_one_minute: spec('Heart rate recovery', 'heart', { color: 'var(--indigo)', agg: 'avg', unit: 'bpm', icon: 'reset', better: 'up' }),
+ vo2_max: spec('VO₂ max', 'heart', { color: 'var(--mint)', dec: 1, icon: 'rocket', better: 'up' }),
+ cardio_recovery: spec('Cardio recovery', 'heart', { color: 'var(--teal)', agg: 'avg', unit: 'bpm', icon: 'reset', better: 'up' }),
+ atrial_fibrillation_burden: spec('AFib burden', 'heart', { color: 'var(--orange)', agg: 'avg', unit: '%', dec: 1, icon: 'warning', better: 'down' }),
// — body —
- weight_body_mass: spec('Weight', 'body', { agg: 'last', unit: 'kg', dec: 1, icon: 'scale' }),
- body_mass_index: spec('BMI', 'body', { agg: 'last', dec: 1, icon: 'scale' }),
- body_fat_percentage: spec('Body fat', 'body', { agg: 'last', unit: '%', dec: 1, icon: 'scale', better: 'down' }),
- lean_body_mass: spec('Lean mass', 'body', { agg: 'last', unit: 'kg', dec: 1, icon: 'arm' }),
- waist_circumference: spec('Waist', 'body', { agg: 'last', unit: 'cm', dec: 1, icon: 'scale', better: 'down' }),
- height: spec('Height', 'body', { agg: 'last', unit: 'cm', icon: 'person' }),
- basal_body_temperature: spec('Basal temperature', 'body', { agg: 'last', unit: '°C', dec: 2, icon: 'flame' }),
- apple_sleeping_wrist_temperature: spec('Wrist temperature', 'body', { agg: 'last', unit: '°C', dec: 2, icon: 'flame' }),
+ weight_body_mass: spec('Weight', 'body', { color: 'var(--blue)', agg: 'last', unit: 'kg', dec: 1, icon: 'scale' }),
+ body_mass_index: spec('BMI', 'body', { color: 'var(--indigo)', agg: 'last', dec: 1, icon: 'scale' }),
+ body_fat_percentage: spec('Body fat', 'body', { color: 'var(--purple)', agg: 'last', unit: '%', dec: 1, icon: 'scale', better: 'down' }),
+ lean_body_mass: spec('Lean mass', 'body', { color: 'var(--teal)', agg: 'last', unit: 'kg', dec: 1, icon: 'arm' }),
+ waist_circumference: spec('Waist', 'body', { color: 'var(--brown)', agg: 'last', unit: 'cm', dec: 1, icon: 'scale', better: 'down' }),
+ height: spec('Height', 'body', { color: 'var(--grey)', agg: 'last', unit: 'cm', icon: 'person' }),
+ basal_body_temperature: spec('Basal temperature', 'body', { color: 'var(--orange)', agg: 'last', unit: '°C', dec: 2, icon: 'flame' }),
+ apple_sleeping_wrist_temperature: spec('Wrist temperature', 'body', { color: 'var(--pink)', agg: 'last', unit: '°C', dec: 2, icon: 'flame' }),
// — sleep — (`asleep` when HAE aggregates the night, `qty` when it sends the segments)
- sleep_analysis: spec('Sleep', 'sleep', { field: ['asleep', 'qty'], unit: 'h', dec: 1, icon: 'moon' }),
- sleep_rem: spec('REM sleep', 'sleep', { agg: 'last', unit: 'h', dec: 1, icon: 'moon' }),
- sleep_core: spec('Core sleep', 'sleep', { agg: 'last', unit: 'h', dec: 1, icon: 'moon' }),
- sleep_deep: spec('Deep sleep', 'sleep', { agg: 'last', unit: 'h', dec: 1, icon: 'moon' }),
+ sleep_analysis: spec('Sleep', 'sleep', { color: 'var(--indigo)', field: ['asleep', 'qty'], unit: 'h', dec: 1, icon: 'moon' }),
+ sleep_rem: spec('REM sleep', 'sleep', { color: 'var(--purple)', agg: 'last', unit: 'h', dec: 1, icon: 'moon' }),
+ sleep_core: spec('Core sleep', 'sleep', { color: 'var(--teal)', agg: 'last', unit: 'h', dec: 1, icon: 'moon' }),
+ sleep_deep: spec('Deep sleep', 'sleep', { color: 'var(--blue)', agg: 'last', unit: 'h', dec: 1, icon: 'moon' }),
// — vitals —
- oxygen_saturation: spec('Blood oxygen', 'vitals', { agg: 'avg', unit: '%', dec: 0, icon: 'target', better: 'up' }),
- respiratory_rate: spec('Respiratory rate', 'vitals', { agg: 'avg', unit: 'breaths/min', dec: 1, icon: 'bolt' }),
- blood_pressure_systolic: spec('Blood pressure', 'vitals', { agg: 'last', unit: 'mmHg', icon: 'heart', better: 'down' }),
- blood_pressure_diastolic: spec('Blood pressure (diastolic)', 'vitals', { agg: 'last', unit: 'mmHg', icon: 'heart', better: 'down' }),
- body_temperature: spec('Body temperature', 'vitals', { agg: 'last', unit: '°C', dec: 2, icon: 'flame' }),
- blood_glucose: spec('Blood glucose', 'vitals', { agg: 'last', unit: 'mg/dL', icon: 'target' }),
- water: spec('Water', 'vitals', { unit: 'L', dec: 2, icon: 'download', better: 'up' }),
- dietary_water: spec('Water', 'vitals', { unit: 'L', dec: 2, icon: 'download', better: 'up' }),
- uv_exposure: spec('UV exposure', 'vitals', { dec: 1, icon: 'sun' }),
- environmental_audio_exposure: spec('Ambient sound', 'vitals', { agg: 'avg', unit: 'dB', icon: 'bolt' }),
- headphone_audio_exposure: spec('Headphone level', 'vitals', { agg: 'avg', unit: 'dB', icon: 'bolt', better: 'down' }),
- walking_steadiness: spec('Walking steadiness', 'vitals', { agg: 'last', unit: '%', icon: 'figureRun', better: 'up' }),
- walking_speed: spec('Walking speed', 'vitals', { agg: 'avg', unit: 'km/h', dec: 1, icon: 'figureRun', better: 'up' }),
- walking_step_length: spec('Step length', 'vitals', { agg: 'avg', unit: 'cm', dec: 1, icon: 'figureRun' }),
- walking_asymmetry_percentage: spec('Walking asymmetry', 'vitals', { agg: 'avg', unit: '%', dec: 1, icon: 'figureRun', better: 'down' }),
- walking_double_support_percentage: spec('Double support', 'vitals', { agg: 'avg', unit: '%', dec: 1, icon: 'figureRun' }),
- stair_speed_up: spec('Stair speed up', 'vitals', { agg: 'avg', icon: 'arrowUp' }),
- stair_speed_down: spec('Stair speed down', 'vitals', { agg: 'avg', icon: 'arrowDown' })
+ oxygen_saturation: spec('Blood oxygen', 'vitals', { color: 'var(--teal)', agg: 'avg', unit: '%', dec: 0, icon: 'target', better: 'up' }),
+ respiratory_rate: spec('Respiratory rate', 'vitals', { color: 'var(--mint)', agg: 'avg', unit: 'breaths/min', dec: 1, icon: 'bolt' }),
+ blood_pressure_systolic: spec('Blood pressure', 'vitals', { color: 'var(--red)', agg: 'last', unit: 'mmHg', icon: 'heart', better: 'down' }),
+ blood_pressure_diastolic: spec('Blood pressure (diastolic)', 'vitals', { color: 'var(--pink)', agg: 'last', unit: 'mmHg', icon: 'heart', better: 'down' }),
+ body_temperature: spec('Body temperature', 'vitals', { color: 'var(--orange)', agg: 'last', unit: '°C', dec: 2, icon: 'flame' }),
+ blood_glucose: spec('Blood glucose', 'vitals', { color: 'var(--purple)', agg: 'last', unit: 'mg/dL', icon: 'target' }),
+ water: spec('Water', 'vitals', { color: 'var(--blue)', unit: 'L', dec: 2, icon: 'download', better: 'up' }),
+ dietary_water: spec('Water', 'vitals', { color: 'var(--blue)', unit: 'L', dec: 2, icon: 'download', better: 'up' }),
+ uv_exposure: spec('UV exposure', 'vitals', { color: 'var(--yellow)', dec: 1, icon: 'sun' }),
+ environmental_audio_exposure: spec('Ambient sound', 'vitals', { color: 'var(--brown)', agg: 'avg', unit: 'dB', icon: 'bolt' }),
+ headphone_audio_exposure: spec('Headphone level', 'vitals', { color: 'var(--yellow)', agg: 'avg', unit: 'dB', icon: 'bolt', better: 'down' }),
+ walking_steadiness: spec('Walking steadiness', 'vitals', { color: 'var(--green)', agg: 'last', unit: '%', icon: 'figureRun', better: 'up' }),
+ walking_speed: spec('Walking speed', 'vitals', { color: 'var(--mint)', agg: 'avg', unit: 'km/h', dec: 1, icon: 'figureRun', better: 'up' }),
+ walking_step_length: spec('Step length', 'vitals', { color: 'var(--teal)', agg: 'avg', unit: 'cm', dec: 1, icon: 'figureRun' }),
+ walking_asymmetry_percentage: spec('Walking asymmetry', 'vitals', { color: 'var(--orange)', agg: 'avg', unit: '%', dec: 1, icon: 'figureRun', better: 'down' }),
+ walking_double_support_percentage: spec('Double support', 'vitals', { color: 'var(--purple)', agg: 'avg', unit: '%', dec: 1, icon: 'figureRun' }),
+ stair_speed_up: spec('Stair speed up', 'vitals', { color: 'var(--orange)', agg: 'avg', icon: 'arrowUp' }),
+ stair_speed_down: spec('Stair speed down', 'vitals', { color: 'var(--blue)', agg: 'avg', icon: 'arrowDown' })
}
const AGG = {
@@ -186,7 +194,7 @@ export function metricCards(data, { days = 90 } = {}) {
name,
label: s.unknown ? s.label : t(s.label),
group: s.group,
- tint: tintOf(s.group),
+ tint: s.color || tintOf(s.group),
unit: s.unit || (m && m.units) || '',
icon: s.icon,
dec: s.dec,
diff --git a/frontend/src/lib/vitals-view.test.js b/frontend/src/lib/vitals-view.test.js
index 0ddd091..affa066 100644
--- a/frontend/src/lib/vitals-view.test.js
+++ b/frontend/src/lib/vitals-view.test.js
@@ -101,19 +101,27 @@ describe('metricCards', () => {
expect(steps.requestedDays).toBe(90)
})
- it('gives every family its own colour, and the unknown ones grey', () => {
+ it('colours each metric on its own, and an unknown one grey', () => {
// The tints are CSS variables, not hex: the light theme redefines them.
const tints = Object.fromEntries(metricCards(doc).map(c => [c.name, c.tint]))
- expect(tints.step_count).toBe('var(--green)') // activity
- expect(tints.heart_rate).toBe('var(--pink)') // heart
- expect(tints.weight_body_mass).toBe('var(--blue)') // body
- expect(tints.sleep_analysis).toBe('var(--indigo)') // sleep
- expect(tints.some_new_metric).toBe('var(--grey)') // other
- // Every group in the catalogue has one, and they are all distinct — two families sharing a
- // colour would defeat the point of colouring them.
- const perGroup = GROUP_ORDER.map(tintOf)
- expect(perGroup.every(Boolean)).toBe(true)
- expect(new Set(perGroup).size).toBe(GROUP_ORDER.length)
+ expect(tints.step_count).toBe('var(--orange)')
+ expect(tints.heart_rate).toBe('var(--red)') // the Health app's colour for a heart rate
+ expect(tints.weight_body_mass).toBe('var(--blue)')
+ expect(tints.sleep_analysis).toBe('var(--indigo)')
+ expect(tints.some_new_metric).toBe('var(--grey)') // nothing to colour it with
+ // Every metric in the catalogue has one...
+ for (const [name, spec] of Object.entries(METRICS)) expect(spec.color, name).toMatch(/^var\(--/)
+ // ...and within a family they are not all the same, which was the complaint: a wall of
+ // identical numbers is what happens when the colour comes from the group.
+ const byGroup = {}
+ for (const [name, spec] of Object.entries(METRICS)) (byGroup[spec.group] ||= []).push(name)
+ for (const [group, names] of Object.entries(byGroup)) {
+ if (names.length < 2) continue
+ const distinct = new Set(names.map(n => METRICS[n].color))
+ expect(distinct.size, `${group} is one flat colour`).toBeGreaterThan(1)
+ }
+ // The fallback is still there for anything the catalogue has not met.
+ expect(GROUP_ORDER.map(tintOf).every(Boolean)).toBe(true)
expect(tintOf('a-group-that-does-not-exist')).toBe('var(--grey)')
})
})
diff --git a/frontend/src/views/Health.render.test.jsx b/frontend/src/views/Health.render.test.jsx
index eb00e06..5eb7131 100644
--- a/frontend/src/views/Health.render.test.jsx
+++ b/frontend/src/views/Health.render.test.jsx
@@ -96,7 +96,7 @@ describe('Salud', () => {
api.mockResolvedValue(VITALS)
await mount()
const tints = cards().map(c => c.style.getPropertyValue('--tint'))
- expect(tints).toEqual(['var(--green)', 'var(--pink)', 'var(--indigo)', 'var(--teal)', 'var(--grey)'])
+ expect(tints).toEqual(['var(--orange)', 'var(--red)', 'var(--indigo)', 'var(--green)', 'var(--grey)'])
expect(cards().every(c => c.getAttribute('style').includes('--tint'))).toBe(true)
})