Skip to content

fix(children): save each child's colour and let it be changed (#1078) - #1080

Merged
tempus2016 merged 1 commit into
mainfrom
fix/1078-during-wizard-and-add-a-child-you-set-a-colour-for
Oct 15, 2026
Merged

tempus2016 merged 1 commit into
mainfrom
fix/1078-during-wizard-and-add-a-child-you-set-a-colour-for

Conversation

@tempus2016

Copy link
Copy Markdown
Owner

Fixes #1078

The setup wizard showed a colour picker for each child but never saved the choice, and the Children dialog had no colour field. The panel always coloured children by their position in the list, using a different palette from the one the wizard showed.

Changes

  • Model: Child.color — "#rrggbb", or "" for the automatic colour. Children saved before this read as "", so nothing changes for them.
  • Validation: add_child, update_child and setup_wizard/apply only accept a #rrggbb hex value (saved lowercase) or empty. Strict, because the panel puts it into a style attribute.
  • Wizard: sends the colour it shows when it creates a child.
  • Edit child dialog: a Colour row with an Automatic swatch (the current position-based colour) plus the wizard's 8 colours.
  • Panel: _childColor() uses the stored colour and falls back to the old palette. It now also colours the avatar on the Children tab, so a new pick is visible straight away.
  • New strings in all 10 locales.

Out of scope: Lovelace cards still use their own header_color option.

Testing

  • tests/test_child_color.py: model round-trip, validator (accepts / lowercases / rejects #fff, red, style injection), wizard save, add, update, and clear. Full suite: 3256 passed. Ruff, ESLint, translation and data-file checks all pass.
  • ha-dev: through the real panel, set Vaiha to purple → saved, the dialog reopens with it selected after a reload, and the Children tab avatar, Today card and child picker all use it. No console errors. A WebSocket probe confirmed storage, the invalid_format rejection, that the colour is kept when other fields are saved, and clearing. A setup_wizard/apply probe confirmed the wizard's colour is stored (probe child removed afterwards).

The setup wizard asked for a colour per child but never sent it, and the
Children dialog had no colour field, so the panel always coloured children
by their place in the list.

- Child gains a `color` ("#rrggbb", or "" for the automatic palette colour),
  strictly validated on add_child, update_child and setup_wizard/apply.
- The wizard sends the colour it shows; the Edit child dialog gets an
  Automatic + swatch picker.
- The panel uses the stored colour wherever it colours a child (Today,
  child picker, Children tab avatar), falling back to the old palette.
- New strings translated in every locale.
@github-actions github-actions Bot added backend Python integration code cards Lovelace cards / frontend (www/*.js) translations i18n / locale strings tests Test suite labels Oct 15, 2026
@tempus2016
tempus2016 merged commit 78de6e9 into main Oct 15, 2026
16 checks passed
@tempus2016
tempus2016 deleted the fix/1078-during-wizard-and-add-a-child-you-set-a-colour-for branch October 15, 2026 20:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend Python integration code cards Lovelace cards / frontend (www/*.js) tests Test suite translations i18n / locale strings

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: During wizard and add a child you set a colour for each child but no way to change after

1 participant