1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-31 13:50:04 -04:00

Add Frame::canvas - bright in bright mode, dark in dark mode (#1362)

and use it in the demo app
This commit is contained in:
Emil Ernerfeldt
2022-03-14 12:33:17 +01:00
committed by GitHub
parent 29c52e8eb6
commit 002158050b
6 changed files with 42 additions and 15 deletions

View File

@@ -80,16 +80,27 @@ impl Frame {
}
}
/// dark canvas to draw on
pub fn dark_canvas(style: &Style) -> Self {
/// A canvas to draw on.
///
/// In bright mode this will be very bright,
/// and in dark mode this will be very dark.
pub fn canvas(style: &Style) -> Self {
Self {
margin: Margin::symmetric(10.0, 10.0),
rounding: style.visuals.widgets.noninteractive.rounding,
fill: Color32::from_black_alpha(250),
fill: style.visuals.extreme_bg_color,
stroke: style.visuals.window_stroke(),
..Default::default()
}
}
/// A dark canvas to draw on.
pub fn dark_canvas(style: &Style) -> Self {
Self {
fill: Color32::from_black_alpha(250),
..Self::canvas(style)
}
}
}
impl Frame {