Skip to content

Commit

Permalink
Update epi.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
rustbasic authored Jun 29, 2024
1 parent d4e8966 commit edbf670
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions crates/eframe/src/epi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,13 +189,15 @@ pub trait App {
/// egui recommends that rendering backends use a normal "gamma-space" (non-sRGB-aware) blending,
/// which means the values you return here should also be in `sRGB` gamma-space in the 0-1 range.
/// You can use [`egui::Color32::to_normalized_gamma_f32`] for this.
fn clear_color(&self, _visuals: &egui::Visuals) -> [f32; 4] {
fn clear_color(&self, visuals: &egui::Visuals) -> [f32; 4] {
// NOTE: a bright gray makes the shadows of the windows look weird.
// We use a bit of transparency so that if the user switches on the
// `transparent()` option they get immediate results.
egui::Color32::from_rgba_unmultiplied(12, 12, 12, 180).to_normalized_gamma_f32()

// _visuals.window_fill() would also be a natural choice
// egui::Color32::from_rgba_unmultiplied(12, 12, 12, 180).to_normalized_gamma_f32()
// or
// visuals.window_fill.to_normalized_gamma_f32()
visuals.window_fill.to_normalized_gamma_f32()
}

/// Controls whether or not the egui memory (window positions etc) will be
Expand Down

0 comments on commit edbf670

Please sign in to comment.