WIP
This commit is contained in:
parent
34ac200437
commit
39b0160064
136 changed files with 7129 additions and 1950 deletions
23
src/vibes.ts
Normal file
23
src/vibes.ts
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
import { appConfig, type VibePreset } from './config';
|
||||
|
||||
export type { GardenVibeSettings, VibePreset } from './config';
|
||||
|
||||
export const VIBE_PRESETS: Array<VibePreset> = appConfig.vibes.presets;
|
||||
|
||||
export const hexToRgb = (hex: string): [number, number, number] => {
|
||||
const value = hex.replace('#', '');
|
||||
return [
|
||||
parseInt(value.slice(0, 2), 16) / 255,
|
||||
parseInt(value.slice(2, 4), 16) / 255,
|
||||
parseInt(value.slice(4, 6), 16) / 255,
|
||||
];
|
||||
};
|
||||
|
||||
export const getInitialVibe = (): VibePreset => {
|
||||
const id = localStorage.getItem(appConfig.storage.vibeKey);
|
||||
return (
|
||||
VIBE_PRESETS.find((vibe) => vibe.id === id) ??
|
||||
VIBE_PRESETS.find((vibe) => vibe.id === appConfig.vibes.defaultVibeId) ??
|
||||
VIBE_PRESETS[0]
|
||||
);
|
||||
};
|
||||
Loading…
Reference in a new issue