Fix no color when only one transfer
This commit is contained in:
parent
507ae44df2
commit
2579f2e965
|
@ -26,6 +26,7 @@ impl ColorPalette {
|
||||||
pub fn get_u8(&self, t: u8, n: u8) -> [f64; 3] {
|
pub fn get_u8(&self, t: u8, n: u8) -> [f64; 3] {
|
||||||
assert!(t > 0, "t must be greater than zero!");
|
assert!(t > 0, "t must be greater than zero!");
|
||||||
assert!(n > 0, "There cannot be zero points!");
|
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)
|
self.get((t - 1) as f64 / (n - 1) as f64)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue