This commit is contained in:
2025-10-10 23:13:57 +02:00
commit 58d1424adb
25 changed files with 1958 additions and 0 deletions

6
src/lib/utils/colors.ts Normal file
View File

@ -0,0 +1,6 @@
export function generateRandomColor(): string {
const hue = Math.floor(Math.random() * 360);
const saturation = 60 + Math.floor(Math.random() * 30);
const lightness = 50 + Math.floor(Math.random() * 20);
return `hsl(${hue}, ${saturation}%, ${lightness}%)`;
}

25
src/lib/utils/settings.ts Normal file
View File

@ -0,0 +1,25 @@
const DEFAULT_VOLUME = 0.7;
const DEFAULT_DURATION = 1.0;
const STORAGE_KEYS = {
VOLUME: 'volume',
DURATION: 'duration',
} as const;
export function loadVolume(): number {
const stored = localStorage.getItem(STORAGE_KEYS.VOLUME);
return stored ? parseFloat(stored) : DEFAULT_VOLUME;
}
export function saveVolume(volume: number): void {
localStorage.setItem(STORAGE_KEYS.VOLUME, volume.toString());
}
export function loadDuration(): number {
const stored = localStorage.getItem(STORAGE_KEYS.DURATION);
return stored ? parseFloat(stored) : DEFAULT_DURATION;
}
export function saveDuration(duration: number): void {
localStorage.setItem(STORAGE_KEYS.DURATION, duration.toString());
}