// Categorical palette slots (validated for light and dark surfaces). // Activity types map to fixed slots so a type keeps its color everywhere. export const CAT_SLOTS = [ { light: '#2a78d6', dark: '#3987e5' }, // blue { light: '#eb6834', dark: '#d95926' }, // orange { light: '#1baf7a', dark: '#199e70' }, // aqua { light: '#eda100', dark: '#c98500' }, // yellow { light: '#e87ba4', dark: '#d55181' }, // magenta { light: '#008300', dark: '#008300' }, // green { light: '#4a3aa7', dark: '#9085e9' }, // violet { light: '#e34948', dark: '#e66767' } // red ]; const TYPE_SLOT: Record = { hiking: 0, hike: 0, walk: 0, walking: 0, run: 1, running: 1, 'trail run': 1, ride: 2, cycling: 2, bike: 2, biking: 2, 'virtual ride': 2, 'mountain bike': 2, climb: 3, climbing: 3, 'via ferrata': 3, alpinism: 3, ski: 6, 'backcountry ski': 6, 'nordic ski': 6, snowboard: 6, snowshoe: 6, segment: 7 }; function hash(s: string): number { let h = 0; for (let i = 0; i < s.length; i++) h = (h * 31 + s.charCodeAt(i)) | 0; return Math.abs(h); } export function typeSlot(type: string): number { const t = type.toLowerCase().trim(); return TYPE_SLOT[t] ?? hash(t) % CAT_SLOTS.length; } export function typeColor(type: string): { light: string; dark: string } { return CAT_SLOTS[typeSlot(type)]; }