model-visuals.ts
1,282 bytes
| 1 | /** |
|---|---|
| 2 | * Stable per-participant visual identity (color + short tag) so the same model |
| 3 | * reads the same across panels, the critique matrix, and the cost chart. |
| 4 | */ |
| 5 | const HUES = [243, 158, 32, 199, 340, 262]; |
| 6 | |
| 7 | export function participantColor(index: number): string { |
| 8 | const hue = HUES[index % HUES.length]!; |
| 9 | return `hsl(${hue} 70% 55%)`; |
| 10 | } |
| 11 | |
| 12 | export function participantColorSoft(index: number): string { |
| 13 | const hue = HUES[index % HUES.length]!; |
| 14 | return `hsl(${hue} 70% 55% / 0.14)`; |
| 15 | } |
| 16 | |
| 17 | /** "A", "B", "C" ... the de-anonymized identity tag shown next to a model. */ |
| 18 | export function participantTag(index: number): string { |
| 19 | return String.fromCharCode(65 + index); |
| 20 | } |
| 21 | |
| 22 | export function stageColorVar(stage: string): string { |
| 23 | switch (stage) { |
| 24 | case 'answer': |
| 25 | return 'var(--stage-answer)'; |
| 26 | case 'critique': |
| 27 | return 'var(--stage-critique)'; |
| 28 | case 'revision': |
| 29 | return 'var(--stage-revision)'; |
| 30 | case 'synthesis': |
| 31 | return 'var(--stage-synthesis)'; |
| 32 | default: |
| 33 | return 'var(--primary)'; |
| 34 | } |
| 35 | } |
| 36 | |
| 37 | /** Blue→green scale for a 1-10 critique score. */ |
| 38 | export function scoreColor(score: number): string { |
| 39 | const t = Math.max(0, Math.min(1, (score - 1) / 9)); |
| 40 | const hue = 8 + t * 140; // red-ish (low) → green (high) |
| 41 | return `hsl(${hue} 65% 45%)`; |
| 42 | } |
| 43 | |