{# Settings ▸ Food, above the fields: how the energy target is worked out (views.plan as p, from Health's energy summary e), what each weight goal would give, every macro preset in grams (views.presets). Read-only — the fields below set it. Styles inline (settings page). #} {% macro n(x) %}{{ "{:,.0f}".format(x).replace(",", " ") if x is not none else "—" }}{% endmacro %}

Energy target

{{ n(p.kcal) }} kcal a day{% if p.set %} — your own number{% endif %}
{% if p.calc %}
Weight{% if p.weight_day %} ({{ p.weight_day.day }} {{ p.weight_day.strftime("%b") }}){% endif %}
{{ "%g" | format(p.weight) }} kg
Resting energy (Mifflin–St Jeor)
{{ n(p.bmr) }} kcal
Your usual day
{{ n(p.maintenance) }} kcal
{% if p.rate %}
{{ "Surplus" if p.rate < 0 else "Deficit" }} for {{ "%g" | format(p.rate | abs) }} % a week ({{ "%g" | format(p.kg_week | abs) }} kg)
{{ "+" if p.rate < 0 else "−" }} {{ n(p.deficit | abs) }} kcal
{% endif %}
Calculated target
{{ n(p.calc) }} kcal
{% if p.capped %}

Limited: at most {{ n(1000) }} kcal under your usual day and never under {{ n(p.floor) }} kcal — more than that only with a doctor.

{% endif %} {% if p.set %}

Your own number below replaces the calculated {{ n(p.calc) }}. Set it to 0 to use the calculation.

{% endif %} {% else %}

Can't calculate a target yet: Health needs your sex, birth date, height (Settings ▸ Health) and a weight measurement. Until then: {{ "your own number" if p.set else "2 000 kcal" }}.

{% endif %}
{% if p.calc %}

Weight goals

{% for o in p.options %}{% endfor %}
Goalkg a weekkcal a day
{{ o.label }}{{ "%+g" | format(-o.kg_week) if o.kg_week else "0" }}{{ n(o.kcal) }}{% if o.capped %} (limited){% endif %}

0.5–1 % of body weight a week is the usual advice for losing weight without losing much muscle; slower is easier to keep up. Your usual day comes from Health's energy estimate and moves with your weight and activity.

{% endif %}

Protein / carbs / fat for {{ n(p.kcal) }} kcal

{% for s in presets %}{% endfor %}
Split%ProteinCarbsFat
{{ s.label }}{{ s.pct | join("·") }}{{ s.g[0] }} g{% if s.per_kg %} {{ s.per_kg }}/kg{% endif %}{{ s.g[1] }} g{{ s.g[2] }} g

Recommended ranges: protein 10–35 %, carbs 45–65 %, fat 20–35 % of the energy. When losing weight, more protein (about 1.2–1.6 g per kg — per kg of a healthy weight if you're heavier) keeps muscle and keeps you full: Higher protein is a good start. Hover a row for what it's for.

Food database

{% if has_db %}

USDA FoodData Central (generic foods, ≈ 13 700, nutrients per 100 g + household portions) — the add form searches it as you type.

{% else %}

Not installed: build dash_data/food/foods.db on the PC with python3 plugins/food/fdc.py <FoodData_Central_csv zip> foods.db and copy it there.

{% endif %}