Improved hotcue icons

This commit is contained in:
patben8 committed 2026-09-25 17:16:16 +02:00
1 parent c1f121ae1d
commit c6aaded26d
5 files changed
+33 -18

No files matched your search

+13 -9
View File
@@ -1,5 +1,6 @@
import type { CuePoint, CueType } from '../api'
import { BEATS_PER_BAR, type BeatGrid } from './beatgrid'
import type { IconName } from './icons'
// Fallback colour by cue type, used when the platform stored none.
const TYPE_COLORS: Record<CueType, string> = {
@@ -20,14 +21,14 @@ export const CUE_TYPE_LABELS: Record<CueType, string> = {
}
// A second, always-present channel for type. Colour used to be type-derived and
// therefore always carried it; now that a user's stored colour wins, the glyph
// therefore always carried it; now that a user's stored colour wins, the icon
// is what keeps a fade-in distinguishable from a plain cue.
const TYPE_GLYPHS: Record<CueType, string> = {
cue: '',
fade_in: '▶',
fade_out: '◀',
load: '⏏',
loop: '⟳',
const TYPE_ICONS: Record<CueType, IconName> = {
cue: 'cueFlag',
fade_in: 'fadeIn',
fade_out: 'fadeOut',
load: 'eject',
loop: 'loop',
}
/**
@@ -49,8 +50,11 @@ export function cueTypeColor(type: CueType): string {
return TYPE_COLORS[type] ?? MEMORY_COLOR
}
export function cueGlyph(cue: CuePoint): string {
return TYPE_GLYPHS[cue.type] ?? ''
/** The pad icon for a cue: its type — or the grid icon for a cue that marks a
* beatgrid marker (Traktor's white companion), since that is what it is. */
export function cueIcon(cue: CuePoint): IconName {
if (cue.grid_marker != null) return 'grid'
return TYPE_ICONS[cue.type] ?? 'cueFlag'
}
export function withAlpha(hex: string, a: number): string {
+5
View File
@@ -85,6 +85,11 @@ const PATHS = {
),
pencil: <path d="M4 20h4L19 9l-4-4L4 16zM13.5 6.5l4 4" strokeLinejoin="round" />,
plus: <path d="M12 5v14M5 12h14" />,
// Cue types, for the hotcue pads.
cueFlag: <path d="M6 21V4M6 4h11l-3 4 3 4H6" strokeLinejoin="round" />,
fadeIn: <path d="M3 19L21 5v14z" strokeLinejoin="round" />,
fadeOut: <path d="M3 5l18 14H3z" strokeLinejoin="round" />,
eject: <path d="M12 4l8 9H4zM4 18h16" strokeLinejoin="round" />,
grid: <path d="M5 3v18M10 3v18M15 3v18M20 3v18" />,
} as const