Fix no color when only one transfer

This commit is contained in:
Emilia Allison 2023-06-08 10:45:58 -04:00
parent 507ae44df2
commit 2579f2e965
Signed by: emilia
GPG Key ID: 7A3F8997BFE894E0
1 changed files with 1 additions and 0 deletions

View File

@ -26,6 +26,7 @@ impl ColorPalette {
pub fn get_u8(&self, t: u8, n: u8) -> [f64; 3] {
assert!(t > 0, "t must be greater than zero!");
assert!(n > 0, "There cannot be zero points!");
if n == 1 {return self.get(0.5f64)}
self.get((t - 1) as f64 / (n - 1) as f64)
}
}