Skip to content

Commit

Permalink
Add back Context::set_visuals() (#5100)
Browse files Browse the repository at this point in the history
My opinion is, it would be better to keep `Context::set_visuals()` so
that you don't get confused.

* Related #4744
  • Loading branch information
rustbasic authored Sep 26, 2024
1 parent 25abb74 commit dae1979
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions crates/egui/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1869,6 +1869,19 @@ impl Context {
self.style_mut_of(theme, |style| style.visuals = visuals);
}

/// The [`crate::Visuals`] used by all subsequent windows, panels etc.
///
/// You can also use [`Ui::visuals_mut`] to change the visuals of a single [`Ui`].
///
/// Example:
/// ```
/// # let mut ctx = egui::Context::default();
/// ctx.set_visuals(egui::Visuals { panel_fill: egui::Color32::RED, ..Default::default() });
/// ```
pub fn set_visuals(&self, visuals: crate::Visuals) {
self.style_mut_of(self.theme(), |style| style.visuals = visuals);
}

/// The number of physical pixels for each logical point.
///
/// This is calculated as [`Self::zoom_factor`] * [`Self::native_pixels_per_point`]
Expand Down

0 comments on commit dae1979

Please sign in to comment.