From de7fb4a942d3d3d23e7fa232db6dcb8d75717614 Mon Sep 17 00:00:00 2001 From: "Luke D. Jones" Date: Fri, 29 Jul 2022 18:59:52 +1200 Subject: [PATCH] ROGCC: use the correct colourspace for colour picker --- rog-aura/src/builtin_modes.rs | 12 ++++++++++++ rog-aura/src/keys.rs | 2 ++ rog-control-center/src/widgets/aura_modes.rs | 8 ++++---- rog-control-center/src/widgets/mod.rs | 4 ++-- 4 files changed, 20 insertions(+), 6 deletions(-) diff --git a/rog-aura/src/builtin_modes.rs b/rog-aura/src/builtin_modes.rs index 56517238..fc65a748 100644 --- a/rog-aura/src/builtin_modes.rs +++ b/rog-aura/src/builtin_modes.rs @@ -79,6 +79,18 @@ impl From for [f32; 3] { } } +impl From<&[u8; 3]> for Colour { + fn from(c: &[u8; 3]) -> Self { + Self(c[0], c[1], c[2]) + } +} + +impl From for [u8; 3] { + fn from(c: Colour) -> Self { + [c.0, c.1, c.2] + } +} + #[cfg_attr(feature = "dbus", derive(Type))] #[derive(Debug, Copy, Clone, PartialEq, Deserialize, Serialize)] pub enum Speed { diff --git a/rog-aura/src/keys.rs b/rog-aura/src/keys.rs index 78c6f36b..94efc92d 100644 --- a/rog-aura/src/keys.rs +++ b/rog-aura/src/keys.rs @@ -258,6 +258,8 @@ impl KeyShape { } } + /// Mostly intended as a helper for signalling when to draw a + /// split/compact arrow cluster pub const fn is_arrow_cluster(&self) -> bool { match self { Self::Arrow | Self::ArrowBlank | Self::ArrowSpacer => true, diff --git a/rog-control-center/src/widgets/aura_modes.rs b/rog-control-center/src/widgets/aura_modes.rs index 46d6398d..0ff1cf13 100644 --- a/rog-control-center/src/widgets/aura_modes.rs +++ b/rog-control-center/src/widgets/aura_modes.rs @@ -61,8 +61,8 @@ pub fn aura_modes_group( ui.selectable_value(&mut effect.direction, a, format!("{:?}", a)); }; - let mut c1: [f32; 3] = effect.colour1.into(); - let mut c2: [f32; 3] = effect.colour2.into(); + let mut c1: [u8; 3] = effect.colour1.into(); + let mut c2: [u8; 3] = effect.colour2.into(); ui.separator(); ui.horizontal_wrapped(|ui| { @@ -118,9 +118,9 @@ pub fn aura_modes_group( } ui.set_enabled(allowed.colour1); - egui::color_picker::color_edit_button_rgb(ui, &mut c1); + egui::color_picker::color_edit_button_srgb(ui, &mut c1); ui.set_enabled(allowed.colour2); - egui::color_picker::color_edit_button_rgb(ui, &mut c2); + egui::color_picker::color_edit_button_srgb(ui, &mut c2); ui.set_enabled(allowed.speed); ui.horizontal_wrapped(|ui| { diff --git a/rog-control-center/src/widgets/mod.rs b/rog-control-center/src/widgets/mod.rs index 7ba3bbcd..9bdcaabb 100644 --- a/rog-control-center/src/widgets/mod.rs +++ b/rog-control-center/src/widgets/mod.rs @@ -2,16 +2,16 @@ mod anime_power; mod aura_modes; mod aura_power; mod fan_graph; +mod keyboard_layout; mod rog_bios; mod side_panel; mod top_bar; -mod keyboard_layout; pub use anime_power::*; pub use aura_modes::*; pub use aura_power::*; pub use fan_graph::*; +pub use keyboard_layout::*; pub use rog_bios::*; pub use side_panel::*; pub use top_bar::*; -pub use keyboard_layout::*; \ No newline at end of file