forge
Explore
Log in

Don't you dare go Hollow

[cfg-breaking] Change colors to 0-255 instead of 0.-1.

Browse files at this commit

02f6b418fef92d076134acbb31e72f38c73dc5baIvan MolodetskikhParent: 8fa5bf9
resources/default-config.kdlmodified+2 -2
@@ -76,10 +76,10 @@ focus-ring {
76 width 476 width 4
77 77
78 // Color of the ring on the active monitor: red, green, blue, alpha.78 // Color of the ring on the active monitor: red, green, blue, alpha.
79- active-color 0.5 0.8 1.0 1.079+ active-color 127 200 255 255
80 80
81 // Color of the ring on inactive monitors: red, green, blue, alpha.81 // Color of the ring on inactive monitors: red, green, blue, alpha.
82- inactive-color 0.3 0.3 0.3 1.082+ inactive-color 80 80 80 255
83 }83 }
84 84
85 cursor {85 cursor {
src/config.rsmodified+21 -21
@@ -137,9 +137,9 @@ pub struct FocusRing {
137 pub off: bool,137 pub off: bool,
138 #[knuffel(child, unwrap(argument), default = 4)]138 #[knuffel(child, unwrap(argument), default = 4)]
139 pub width: u16,139 pub width: u16,
140- #[knuffel(child, default = Color::new(0.5, 0.8, 1.0, 1.0))]140+ #[knuffel(child, default = Color::new(127, 200, 255, 255))]
141 pub active_color: Color,141 pub active_color: Color,
142- #[knuffel(child, default = Color::new(0.3, 0.3, 0.3, 1.0))]142+ #[knuffel(child, default = Color::new(80, 80, 80, 255))]
143 pub inactive_color: Color,143 pub inactive_color: Color,
144 }144 }
145 145
@@ -148,33 +148,33 @@ impl Default for FocusRing {
148 Self {148 Self {
149 off: false,149 off: false,
150 width: 4,150 width: 4,
151- active_color: Color::new(0.5, 0.8, 1.0, 1.0),151+ active_color: Color::new(127, 200, 255, 255),
152- inactive_color: Color::new(0.3, 0.3, 0.3, 1.0),152+ inactive_color: Color::new(80, 80, 80, 255),
153 }153 }
154 }154 }
155 }155 }
156 156
157-#[derive(knuffel::Decode, Debug, Default, Clone, Copy, PartialEq)]157+#[derive(knuffel::Decode, Debug, Default, Clone, Copy, PartialEq, Eq)]
158 pub struct Color {158 pub struct Color {
159 #[knuffel(argument)]159 #[knuffel(argument)]
160- pub r: f32,160+ pub r: u8,
161 #[knuffel(argument)]161 #[knuffel(argument)]
162- pub g: f32,162+ pub g: u8,
163 #[knuffel(argument)]163 #[knuffel(argument)]
164- pub b: f32,164+ pub b: u8,
165 #[knuffel(argument)]165 #[knuffel(argument)]
166- pub a: f32,166+ pub a: u8,
167 }167 }
168 168
169 impl Color {169 impl Color {
170- pub fn new(r: f32, g: f32, b: f32, a: f32) -> Self {170+ pub fn new(r: u8, g: u8, b: u8, a: u8) -> Self {
171 Self { r, g, b, a }171 Self { r, g, b, a }
172 }172 }
173 }173 }
174 174
175 impl From<Color> for [f32; 4] {175 impl From<Color> for [f32; 4] {
176 fn from(c: Color) -> Self {176 fn from(c: Color) -> Self {
177- [c.r, c.g, c.b, c.a]177+ [c.r, c.g, c.b, c.a].map(|x| x as f32 / 255.)
178 }178 }
179 }179 }
180 180
@@ -521,8 +521,8 @@ mod tests {
521 521
522 focus-ring {522 focus-ring {
523 width 5523 width 5
524- active-color 0.0 0.25 0.5 1.0524+ active-color 0 100 200 255
525- inactive-color 1.0 0.5 0.25 0.0525+ inactive-color 255 200 100 0
526 }526 }
527 527
528 prefer-no-csd528 prefer-no-csd
@@ -593,16 +593,16 @@ mod tests {
593 off: false,593 off: false,
594 width: 5,594 width: 5,
595 active_color: Color {595 active_color: Color {
596- r: 0.,596+ r: 0,
597- g: 0.25,597+ g: 100,
598- b: 0.5,598+ b: 200,
599- a: 1.,599+ a: 255,
600 },600 },
601 inactive_color: Color {601 inactive_color: Color {
602- r: 1.,602+ r: 255,
603- g: 0.5,603+ g: 200,
604- b: 0.25,604+ b: 100,
605- a: 0.,605+ a: 0,
606 },606 },
607 },607 },
608 prefer_no_csd: true,608 prefer_no_csd: true,