Skip to content

Commit

Permalink
Add comment about spectral RGB color mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
uklotzde committed Jan 21, 2024
1 parent 52fb55b commit 175e45f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/waveform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ impl FilteredWaveformVal {
let low = low.to_f32();
let mid = mid.to_f32();
let high = high.to_f32();
// The `all` value is needed to control the brightness of the resulting color.
// Otherwise we would only reach the edges of the RGB space with one component
// always maxed out.
let denom = all.max(low).max(mid).max(high);
if denom == 0.0 {
return Srgb::new(0.0, 0.0, 0.0);
Expand Down

0 comments on commit 175e45f

Please sign in to comment.