mirror of
https://github.com/niri-wm/niri.git
synced 2026-06-23 02:05:33 +07:00
[cfg-breaking] Change colors to 0-255 instead of 0.-1.
This commit is contained in:
@@ -76,10 +76,10 @@ focus-ring {
|
|||||||
width 4
|
width 4
|
||||||
|
|
||||||
// Color of the ring on the active monitor: red, green, blue, alpha.
|
// Color of the ring on the active monitor: red, green, blue, alpha.
|
||||||
active-color 0.5 0.8 1.0 1.0
|
active-color 127 200 255 255
|
||||||
|
|
||||||
// Color of the ring on inactive monitors: red, green, blue, alpha.
|
// Color of the ring on inactive monitors: red, green, blue, alpha.
|
||||||
inactive-color 0.3 0.3 0.3 1.0
|
inactive-color 80 80 80 255
|
||||||
}
|
}
|
||||||
|
|
||||||
cursor {
|
cursor {
|
||||||
|
|||||||
+21
-21
@@ -137,9 +137,9 @@ pub struct FocusRing {
|
|||||||
pub off: bool,
|
pub off: bool,
|
||||||
#[knuffel(child, unwrap(argument), default = 4)]
|
#[knuffel(child, unwrap(argument), default = 4)]
|
||||||
pub width: u16,
|
pub width: u16,
|
||||||
#[knuffel(child, default = Color::new(0.5, 0.8, 1.0, 1.0))]
|
#[knuffel(child, default = Color::new(127, 200, 255, 255))]
|
||||||
pub active_color: Color,
|
pub active_color: Color,
|
||||||
#[knuffel(child, default = Color::new(0.3, 0.3, 0.3, 1.0))]
|
#[knuffel(child, default = Color::new(80, 80, 80, 255))]
|
||||||
pub inactive_color: Color,
|
pub inactive_color: Color,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -148,33 +148,33 @@ impl Default for FocusRing {
|
|||||||
Self {
|
Self {
|
||||||
off: false,
|
off: false,
|
||||||
width: 4,
|
width: 4,
|
||||||
active_color: Color::new(0.5, 0.8, 1.0, 1.0),
|
active_color: Color::new(127, 200, 255, 255),
|
||||||
inactive_color: Color::new(0.3, 0.3, 0.3, 1.0),
|
inactive_color: Color::new(80, 80, 80, 255),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(knuffel::Decode, Debug, Default, Clone, Copy, PartialEq)]
|
#[derive(knuffel::Decode, Debug, Default, Clone, Copy, PartialEq, Eq)]
|
||||||
pub struct Color {
|
pub struct Color {
|
||||||
#[knuffel(argument)]
|
#[knuffel(argument)]
|
||||||
pub r: f32,
|
pub r: u8,
|
||||||
#[knuffel(argument)]
|
#[knuffel(argument)]
|
||||||
pub g: f32,
|
pub g: u8,
|
||||||
#[knuffel(argument)]
|
#[knuffel(argument)]
|
||||||
pub b: f32,
|
pub b: u8,
|
||||||
#[knuffel(argument)]
|
#[knuffel(argument)]
|
||||||
pub a: f32,
|
pub a: u8,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Color {
|
impl Color {
|
||||||
pub fn new(r: f32, g: f32, b: f32, a: f32) -> Self {
|
pub fn new(r: u8, g: u8, b: u8, a: u8) -> Self {
|
||||||
Self { r, g, b, a }
|
Self { r, g, b, a }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Color> for [f32; 4] {
|
impl From<Color> for [f32; 4] {
|
||||||
fn from(c: Color) -> Self {
|
fn from(c: Color) -> Self {
|
||||||
[c.r, c.g, c.b, c.a]
|
[c.r, c.g, c.b, c.a].map(|x| x as f32 / 255.)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -521,8 +521,8 @@ mod tests {
|
|||||||
|
|
||||||
focus-ring {
|
focus-ring {
|
||||||
width 5
|
width 5
|
||||||
active-color 0.0 0.25 0.5 1.0
|
active-color 0 100 200 255
|
||||||
inactive-color 1.0 0.5 0.25 0.0
|
inactive-color 255 200 100 0
|
||||||
}
|
}
|
||||||
|
|
||||||
prefer-no-csd
|
prefer-no-csd
|
||||||
@@ -593,16 +593,16 @@ mod tests {
|
|||||||
off: false,
|
off: false,
|
||||||
width: 5,
|
width: 5,
|
||||||
active_color: Color {
|
active_color: Color {
|
||||||
r: 0.,
|
r: 0,
|
||||||
g: 0.25,
|
g: 100,
|
||||||
b: 0.5,
|
b: 200,
|
||||||
a: 1.,
|
a: 255,
|
||||||
},
|
},
|
||||||
inactive_color: Color {
|
inactive_color: Color {
|
||||||
r: 1.,
|
r: 255,
|
||||||
g: 0.5,
|
g: 200,
|
||||||
b: 0.25,
|
b: 100,
|
||||||
a: 0.,
|
a: 0,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
prefer_no_csd: true,
|
prefer_no_csd: true,
|
||||||
|
|||||||
Reference in New Issue
Block a user