ROGCC: use the correct colourspace for colour picker

This commit is contained in:
Luke D. Jones
2022-07-29 18:59:52 +12:00
parent 4164b4645d
commit de7fb4a942
4 changed files with 20 additions and 6 deletions

View File

@@ -79,6 +79,18 @@ impl From<Colour> for [f32; 3] {
}
}
impl From<&[u8; 3]> for Colour {
fn from(c: &[u8; 3]) -> Self {
Self(c[0], c[1], c[2])
}
}
impl From<Colour> 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 {

View File

@@ -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,

View File

@@ -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| {

View File

@@ -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::*;