Skip to content

Commit

Permalink
fix: don't calculate color for invalid times
Browse files Browse the repository at this point in the history
there is current unrelated behavior that, when
the planner is clicked on to create a new task,
momentarily, the `planItem` object does not
conform to the same structure as it usually does.
This was causing an error when calculating the background.
  • Loading branch information
Joseph Brooksbank authored and Joseph Brooksbank committed Sep 5, 2023
1 parent c2404bd commit 6f2047c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/ui/components/task.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@
$: colorScale = chroma.scale([$settings.timelineStartColor, $settings.timelineEndColor]).mode("lab");
$: backgroundColor = $settings.timelineColored
$: backgroundColor = $settings.timelineColored && planItem.startTime
? colorScale((planItem.startTime.hour() - $settings.startHour )/ (24-$settings.startHour)).hex()
: "var(--background-primary)";
let properContrastColors: IContrastColors;
$: properContrastColors = $settings.timelineColored
$: properContrastColors = $settings.timelineColored && planItem.startTime
? getTextColorWithEnoughContrast(backgroundColor)
: {
normal: "var(--text-normal)",
Expand Down

0 comments on commit 6f2047c

Please sign in to comment.