Initial Commit

This commit is contained in:
2026-10-03 20:07:49 +02:00
commit a1346c98b1
427 changed files with 59320 additions and 0 deletions
+18
View File
@@ -0,0 +1,18 @@
import { randomInt } from 'node:crypto'
export function randomUserColor() {
const h = randomInt(360)
const s = 60 + randomInt(30)
const l = 50 + randomInt(15)
const a = s * Math.min(l, 100 - l) / 100
const f = (n: number) => {
const k = (n + h / 30) % 12
const v = l / 100 - a * Math.max(-1, Math.min(k - 3, 9 - k, 1))
return Math.round(Math.min(1, Math.max(0, v)) * 255)
}
return `#${[f(0), f(8), f(4)].map(v => v.toString(16).padStart(2, '0')).join('')}`
}
export function avatarUrl(avatar: string | null) {
return avatar ? `/uploads/avatars/${avatar}` : null
}