Fix underflow when indexing into ColorScales

This commit is contained in:
Marshall Bowers 2023-11-01 21:15:06 -04:00
parent 115bd65344
commit 220228c183

View file

@ -132,19 +132,19 @@ impl ColorScaleSet {
} }
pub fn light(&self, step: ColorScaleStep) -> Hsla { pub fn light(&self, step: ColorScaleStep) -> Hsla {
self.light[step - 1] self.light[step]
} }
pub fn light_alpha(&self, step: ColorScaleStep) -> Hsla { pub fn light_alpha(&self, step: ColorScaleStep) -> Hsla {
self.light_alpha[step - 1] self.light_alpha[step]
} }
pub fn dark(&self, step: ColorScaleStep) -> Hsla { pub fn dark(&self, step: ColorScaleStep) -> Hsla {
self.dark[step - 1] self.dark[step]
} }
pub fn dark_alpha(&self, step: ColorScaleStep) -> Hsla { pub fn dark_alpha(&self, step: ColorScaleStep) -> Hsla {
self.dark_alpha[step - 1] self.dark_alpha[step]
} }
pub fn step(&self, cx: &AppContext, step: ColorScaleStep) -> Hsla { pub fn step(&self, cx: &AppContext, step: ColorScaleStep) -> Hsla {