Skip to content

Commit

Permalink
Fix initial edge bug
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesnw committed Dec 11, 2024
1 parent f90ce41 commit 525812e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const sliderGradient = (
hue: 'raw',
maxDeltaE: 10,
});
let wasInGamut = false;
let wasInGamut: boolean;
const inGamutSteps: string[] = [];
const stepWidth = 100 / (gradientSteps.length - 1);

Expand All @@ -45,13 +45,13 @@ export const sliderGradient = (

gradientSteps.forEach((step, index) => {
if (inGamut(step, 'p3')) {
if (!wasInGamut) {
if (wasInGamut === false) {
inGamutSteps.push(`transparent ${stepWidth * (index + 1)}%`);
}
wasInGamut = true;
inGamutSteps.push(`${display(step)} ${stepWidth * index}%`);
} else {
if (wasInGamut) {
if (wasInGamut === true) {
inGamutSteps.push(`transparent ${stepWidth * (index - 1)}%`);
}
inGamutSteps.push(`transparent ${stepWidth * index}%`);
Expand Down

0 comments on commit 525812e

Please sign in to comment.