from __future__ import annotations # The colour palette, and the one place that clamps to it. # # It lived on `models/note.py` until M315, when a note stopped having a colour. A # palette defined on the model that lost one would be a standing invitation to put the # column back; here it reads as what it now is — a LABEL's vocabulary, shared with the # saved-filter and import paths that still name a colour. # # Keys, not tints. The actual colours live in each client (frontend/src/notes/colors.ts # and NoteTint.kt), so they can be retuned without a schema migration — which M315 spent # two steps doing. NOTE_COLORS = { "default", "red", "orange", "yellow", "green", "teal", "blue", "purple", "pink", "gray", } __all__ = ["NOTE_COLORS", "normalize_color"] def normalize_color(color: object) -> str: """Return `color` if it's a known palette key, else the default. `default` is no longer something anybody can CHOOSE — nothing offers a colour picker since M315 — but it is still where unrecognised input has to land, so this fallback is unreachable by choice rather than dead. """ return color if color in NOTE_COLORS else "default"