Skip to content

Commit

Permalink
Show error if not a hex length
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesnw committed Nov 4, 2024
1 parent 01691c4 commit 81d1b6a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/lib/components/colors/Header.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@
// If it's possibly hex without a hash, add a hash and try again.
if ([3, 4, 6, 8].includes(value.length)) {
newColor = to(`#${value}`, targetSpace, { inGamut: true });
} else {
throw error;
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
} catch (errorWithHash) {
Expand Down

0 comments on commit 81d1b6a

Please sign in to comment.