Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion nav-app/src/app/classes/gradient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,8 @@ export class Gradient {
return this.gradientRGB[0].toHexString();
}
let index = ((value - this.minValue) / (this.maxValue - this.minValue)) * 100;
return this.gradientRGB[Math.round(index)].toHexString();
let indexRounded = Math.round(index) > this.gradientRGB.length - 1 ? this.gradientRGB.length - 1 : Math.round(index); // prune value to the maximum possible index of the array
return this.gradientRGB[indexRounded].toHexString();
}
}

Expand Down