diff --git a/src/components/plates/util.rs b/src/components/plates/util.rs index e0af9e4..efeeb10 100644 --- a/src/components/plates/util.rs +++ b/src/components/plates/util.rs @@ -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) } }