Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AmyPfuNc4sCRfaF3oURXZz
11 lines
813 B
TypeScript
11 lines
813 B
TypeScript
// Projektfarben: eigene Farbe des Projekts, sonst reihum nach der Reihenfolge im Terminplan.
|
|
// Terminplan, Handy und Übersicht nehmen dieselbe Farbe (Henning, 23.10.2026).
|
|
export const FARBEN = ["#1d5fa8", "#2f6b5a", "#b7791f", "#a26e3a", "#805ad5", "#c53030", "#2c7a7b", "#97266d", "#4a5568", "#6b8e23"];
|
|
|
|
/** alle = Projekte des Terminplans in ihrer Reihenfolge; gezählt werden nur die nicht abgeschlossenen (wie der Terminplan ohne Filter), abgeschlossene sind grau */
|
|
export function projektFarbe(p: { id: string; farbe?: string | null }, alle: { id: string; status?: string }[]): string {
|
|
if (/^#[0-9a-f]{6}$/i.test(p.farbe ?? "")) return p.farbe!;
|
|
const i = alle.filter((x) => x.status !== "abgeschlossen").findIndex((x) => x.id === p.id);
|
|
return i < 0 ? "#718096" : FARBEN[i % FARBEN.length]!;
|
|
}
|