Skip to content

Commit

Permalink
Simplify legend
Browse files Browse the repository at this point in the history
  • Loading branch information
keesverruijt committed Oct 15, 2024
1 parent 642ce6f commit c5b03ef
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions src/radar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -780,23 +780,15 @@ fn default_legend(doppler: bool, pixel_values: u8) -> Legend {
r#type: PixelType::Normal,
color: Color {
// red starts at 2/3 and peaks at end
r: if v >= two_thirds {
(start + ((v - two_thirds) as f32) * delta) as u8
} else {
0
},
r: if v >= two_thirds { 200 } else { 0 },
// green starts at 1/3 and peaks at 2/3
g: if v >= one_third && v < two_thirds {
(start + ((v - one_third) as f32) * delta) as u8
200
} else {
0
},
// blue peaks at 1/3
b: if v < one_third {
(start + (v as f32) * (WHITE / (pixel_values as f32))) as u8
} else {
0
},
b: if v < one_third { 200 } else { 0 },
a: OPAQUE,
},
});
Expand Down

0 comments on commit c5b03ef

Please sign in to comment.