MCPcopy Create free account
hub / github.com/donkeyteethUX/iced_plot / default_style

Function default_style

src/style.rs:53–96  ·  view source on GitHub ↗

Returns the default plot style derived from the current application theme.

(theme: &Theme)

Source from the content-addressed store, hash-verified

51
52/// Returns the default plot style derived from the current application theme.
53pub fn default_style(theme: &Theme) -> PlotStyle {
54 let palette = theme.extended_palette();
55 let grid_base = palette.background.base.text;
56
57 PlotStyle {
58 frame: container::background(theme.palette().background),
59 plot_area: container::background(theme.palette().background),
60 legend: container::Style {
61 background: Some(palette.background.weakest.color.into()),
62 text_color: Some(palette.background.weakest.text),
63 border: iced::Border {
64 width: 1.0,
65 radius: 5.0.into(),
66 color: palette.background.weak.color,
67 },
68 ..container::Style::default()
69 },
70 controls_panel: container::Style {
71 background: Some(palette.background.weak.color.into()),
72 text_color: Some(palette.background.weak.text),
73 border: border::rounded(2),
74 ..container::Style::default()
75 },
76 cursor_overlay: container::Style {
77 background: Some(palette.background.weak.color.into()),
78 text_color: Some(palette.background.weak.text),
79 border: border::rounded(2),
80 ..container::Style::default()
81 },
82 tooltip: container::Style {
83 background: Some(palette.background.weak.color.scale_alpha(0.7).into()),
84 text_color: Some(palette.background.weak.text.scale_alpha(0.7)),
85 border: border::rounded(2),
86 ..container::Style::default()
87 },
88 grid: GridStyle {
89 major: with_alpha(grid_base, 0.45),
90 minor: with_alpha(grid_base, 0.28),
91 sub_minor: with_alpha(grid_base, 0.10),
92 },
93 tick_label_color: palette.background.base.text,
94 axis_label_color: palette.background.strong.text,
95 }
96}
97
98fn with_alpha(color: Color, alpha: f32) -> Color {
99 Color { a: alpha, ..color }

Callers 3

style1Function · 0.85
style2Function · 0.85
style3Function · 0.85

Calls 1

with_alphaFunction · 0.70

Tested by

no test coverage detected