Switched to more generic wording

This commit is contained in:
patben8 committed 2026-09-17 22:24:56 +02:00
1 parent c9e85bbdb5
commit 6e24f5ef1d
29 files changed
+796 -319

No files matched your search

+10 -10
View File
@@ -12,14 +12,14 @@ export function formatBpm(bpm: number | null): string {
return bpm.toFixed(1)
}
// Traktor stores keys like "10m" / "8d" (Open Key notation) or classic "8A".
// Give each of the 12 pitch classes a stable hue so harmonic groups read at a
// glance — adjacent/compatible keys land near each other on the color wheel.
export function keyColor(key: string | null): string | undefined {
if (!key) return undefined
const m = key.match(/(\d+)/)
if (!m) return undefined
const n = parseInt(m[1], 10) % 12
const hue = (n / 12) * 360
return `hsl(${hue} 65% 62%)`
/**
* Hue by wheel position, so harmonically adjacent keys sit adjacent in colour.
*
* Takes the parsed Camelot position rather than the key string: "10m" vs "Am"
* vs "8A" is platform notation, and parsing it is the adapter's job. Doing it
* here used to mean every non-Traktor key lost its colour.
*/
export function keyColor(wheel: number | null): string | undefined {
if (wheel == null) return undefined
return `hsl(${((wheel % 12) / 12) * 360} 65% 62%)`
}