Fix clippy nags

This commit is contained in:
2023-11-05 13:28:20 +01:00
parent e458c69c80
commit fee9c7a171
4 changed files with 27 additions and 24 deletions

View File

@ -19,7 +19,7 @@ pub struct ColorPicker {
#[derive(Default)]
enum ColorPickerSetting {
#[default]
HSB,
Hsb,
Kelvin,
}
@ -55,14 +55,14 @@ impl ColorPicker {
}
match self.dragging.take() {
Some(ColorPickerAttr::HueSat) => self.mode = ColorPickerSetting::HSB,
Some(ColorPickerAttr::HueSat) => self.mode = ColorPickerSetting::Hsb,
Some(ColorPickerAttr::Brightness) => {}
Some(ColorPickerAttr::Temperature) => self.mode = ColorPickerSetting::Kelvin,
None => return,
}
let color = match self.mode {
ColorPickerSetting::HSB => {
ColorPickerSetting::Hsb => {
BulbColor::hsb(self.hue, self.saturation, self.brightness)
}
ColorPickerSetting::Kelvin => {
@ -130,10 +130,12 @@ impl ColorPicker {
let (r, g, b) = hsb_to_rgb(self.hue, 1.0, 1.0);
let saturation_gradient = match self.mode {
ColorPickerSetting::HSB => {
ColorPickerSetting::Hsb => {
format!("background: linear-gradient(0deg, #000, rgba({r},{g},{b},1));")
}
ColorPickerSetting::Kelvin => format!("background: linear-gradient(0deg, #000, #fff);"),
ColorPickerSetting::Kelvin => {
"background: linear-gradient(0deg, #000, #fff);".to_string()
}
};
div![
@ -186,7 +188,7 @@ impl ColorPicker {
self.hue = h;
self.saturation = s;
self.brightness = b;
self.mode = ColorPickerSetting::HSB;
self.mode = ColorPickerSetting::Hsb;
}
pub fn set_kelvin(&mut self, t: f32, b: f32) {