From aa74fd2bbcaf42f2befc670ad28908930c1df0c4 Mon Sep 17 00:00:00 2001 From: Matthieu Date: Thu, 21 May 2026 09:13:38 +0200 Subject: [PATCH] =?UTF-8?q?feat(workflow)=20:=20palette=20de=20cat=C3=A9go?= =?UTF-8?q?ries=20canonique=20+=20helper=20de=20contraste?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.7 (1M context) --- frontend/services/dto/workflow.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/frontend/services/dto/workflow.ts b/frontend/services/dto/workflow.ts index 783dd1f..a17fd08 100644 --- a/frontend/services/dto/workflow.ts +++ b/frontend/services/dto/workflow.ts @@ -10,6 +10,25 @@ export const STATUS_CATEGORY_LABEL: Record = { done: 'Terminé', } +/** Palette canonique des catégories (couleurs « classiques »), indépendante des workflows. */ +export const STATUS_CATEGORY_COLOR: Record = { + todo: '#222783', + in_progress: '#4A90D9', + blocked: '#C62828', + review: '#FF8F00', + done: '#26A69A', +} + +/** Renvoie '#1f2937' (foncé) ou '#ffffff' (blanc) selon la luminance du fond, pour rester lisible. */ +export function contrastText(hex: string): string { + const c = hex.replace('#', '') + const r = parseInt(c.slice(0, 2), 16) + const g = parseInt(c.slice(2, 4), 16) + const b = parseInt(c.slice(4, 6), 16) + const lum = (0.299 * r + 0.587 * g + 0.114 * b) / 255 + return lum > 0.6 ? '#1f2937' : '#ffffff' +} + export type Workflow = { id: number '@id'?: string