Skip to content

Commit 5d62a8a

Browse files
committed
Tweak shadows
1 parent 05081d0 commit 5d62a8a

File tree

3 files changed

+19
-5
lines changed

3 files changed

+19
-5
lines changed

egui/src/containers/frame.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ impl Frame {
6464
Self {
6565
margin: Vec2::splat(1.0),
6666
corner_radius: style.visuals.widgets.noninteractive.corner_radius,
67-
shadow: Shadow::small(),
67+
shadow: style.visuals.popup_shadow,
6868
fill: style.visuals.window_fill(),
6969
stroke: style.visuals.window_stroke(),
7070
}
@@ -74,7 +74,7 @@ impl Frame {
7474
Self {
7575
margin: style.spacing.window_padding,
7676
corner_radius: style.visuals.widgets.noninteractive.corner_radius,
77-
shadow: Shadow::small(),
77+
shadow: style.visuals.popup_shadow,
7878
fill: style.visuals.window_fill(),
7979
stroke: style.visuals.window_stroke(),
8080
}

egui/src/style.rs

+6
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,8 @@ pub struct Visuals {
214214
pub window_corner_radius: f32,
215215
pub window_shadow: Shadow,
216216

217+
pub popup_shadow: Shadow,
218+
217219
pub resize_corner_size: f32,
218220

219221
pub text_cursor_width: f32,
@@ -402,6 +404,7 @@ impl Visuals {
402404
code_bg_color: Color32::from_gray(64),
403405
window_corner_radius: 6.0,
404406
window_shadow: Shadow::big_dark(),
407+
popup_shadow: Shadow::small_dark(),
405408
resize_corner_size: 12.0,
406409
text_cursor_width: 2.0,
407410
text_cursor_preview: false,
@@ -422,6 +425,7 @@ impl Visuals {
422425
extreme_bg_color: Color32::from_gray(250),
423426
code_bg_color: Color32::from_gray(200),
424427
window_shadow: Shadow::big_light(),
428+
popup_shadow: Shadow::small_light(),
425429
..Self::dark()
426430
}
427431
}
@@ -824,6 +828,7 @@ impl Visuals {
824828
code_bg_color,
825829
window_corner_radius,
826830
window_shadow,
831+
popup_shadow,
827832
resize_corner_size,
828833
text_cursor_width,
829834
text_cursor_preview,
@@ -848,6 +853,7 @@ impl Visuals {
848853
stroke_ui(ui, &mut widgets.noninteractive.bg_stroke, "Outline");
849854
ui.add(Slider::new(window_corner_radius, 0.0..=20.0).text("Rounding"));
850855
shadow_ui(ui, window_shadow, "Shadow");
856+
shadow_ui(ui, popup_shadow, "Shadow (small menus and popups)");
851857
});
852858

853859
ui.collapsing("Widgets", |ui| widgets.ui(ui));

epaint/src/shadow.rs

+11-3
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,18 @@ pub struct Shadow {
1515

1616
impl Shadow {
1717
/// Tooltips, menus, ...
18-
pub fn small() -> Self {
18+
pub fn small_dark() -> Self {
1919
Self {
20-
extrusion: 8.0,
21-
color: Color32::from_black_alpha(64),
20+
extrusion: 16.0,
21+
color: Color32::from_black_alpha(96),
22+
}
23+
}
24+
25+
/// Tooltips, menus, ...
26+
pub fn small_light() -> Self {
27+
Self {
28+
extrusion: 16.0,
29+
color: Color32::from_black_alpha(32),
2230
}
2331
}
2432

0 commit comments

Comments
 (0)