Download apps/web/src/lib/taskTint.ts from aliroya/contiai: direct link, hf CLI and curl.
- Browser
- Download file 997 Bytes
-
https://huggingface.co/spaces/aliroya/contiai/resolve/main/apps/web/src/lib/taskTint.ts
- Command line
-
hf download hf://spaces/aliroya/contiai/apps/web/src/lib/taskTint.ts
-
curl -L -o taskTint.ts https://huggingface.co/spaces/aliroya/contiai/resolve/main/apps/web/src/lib/taskTint.ts
997 Bytes
| /* One colour per task type, everywhere it appears. | |
| The icon chip on the create grid, the eyebrow on a project card, the badge | |
| in the library and the donut slice on the usage screen all agree, so "books | |
| are ultramarine, bags are teal" becomes something the eye learns once. | |
| The six colours are the CVD-verified viz series; known types get a stable | |
| assignment and anything new falls back to a hash, so a type added on the | |
| server still gets a consistent colour without touching this file. */ | |
| const ORDER: Record<string, number> = { | |
| book: 0, | |
| training_bag: 2, | |
| course: 1, | |
| level: 3, | |
| references: 4, | |
| appendix: 5, | |
| }; | |
| function slot(key: string): number { | |
| if (key in ORDER) return ORDER[key]; | |
| let h = 0; | |
| for (const ch of key) h = (h * 31 + ch.charCodeAt(0)) % 997; | |
| return h % 6; | |
| } | |
| export function taskColor(key: string): string { | |
| return `var(--viz-${slot(key) + 1})`; | |
| } | |
| export function taskTintBg(key: string): string { | |
| return `var(--tint-${slot(key) + 1})`; | |
| } | |