feat: course color generation (#179)
* feat: course color generation * feat: add proper TS for hex colors * refactor: fix oklab and improve contrast ratios * fix: update HexColor type * refactor: update color switch point * refactor: color-related functions and types * fix: imports and TS issues * fix: imports and TS issues * chore: add no-restricted-syntax ForInStatement * chore(docs): add jsdoc --------- Co-authored-by: doprz <52579214+doprz@users.noreply.github.com>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { UserScheduleStore } from '@shared/storage/UserScheduleStore';
|
||||
import type { Course } from '@shared/types/Course';
|
||||
import { getUnusedColor } from '@shared/util/colors';
|
||||
|
||||
/**
|
||||
* Adds a course to a user's schedule.
|
||||
@@ -15,6 +16,7 @@ export default async function addCourse(scheduleId: string, course: Course): Pro
|
||||
throw new Error('Schedule not found');
|
||||
}
|
||||
|
||||
course.colors = getUnusedColor(activeSchedule, course);
|
||||
activeSchedule.courses.push(course);
|
||||
activeSchedule.updatedAt = Date.now();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user