Skip to content

Commit

Permalink
donut charts inner circle background color
Browse files Browse the repository at this point in the history
  • Loading branch information
GyulyVGC committed Mar 1, 2025
1 parent ebd8917 commit 0ef637f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/chart/types/donut_chart.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,10 @@ impl<Message, Theme: Catalog> canvas::Program<Message, Theme> for DonutChart {
font: self.font,
..Default::default()
});
frame.fill(&circle, style.background);

frame.fill(&incoming, style.incoming);
frame.fill(&outgoing, style.outgoing);
frame.fill(&inner_circle, style.rail);
frame.fill(&inner_circle, style.background);

vec![frame.into_geometry()]
}
Expand Down
12 changes: 9 additions & 3 deletions src/gui/styles/donut.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,18 @@ impl DonutType {
fn active(&self, style: &StyleType) -> Style {
let colors = style.get_palette();
let ext = style.get_extension();
let primary = colors.primary;
let buttons = ext.buttons_color;
let background = Color {
r: primary.r + (buttons.r - primary.r) * ext.alpha_round_containers,
g: primary.g + (buttons.g - primary.g) * ext.alpha_round_containers,
b: primary.b + (buttons.b - primary.b) * ext.alpha_round_containers,
a: 1.0,
};
Style {
background: Color::TRANSPARENT,
background,
incoming: colors.secondary,
outgoing: colors.outgoing,
rail: colors.primary,
text_color: colors.text_body,
}
}
Expand All @@ -39,7 +46,6 @@ pub struct Style {
pub(crate) background: Color,
pub(crate) incoming: Color,
pub(crate) outgoing: Color,
pub(crate) rail: Color,
pub(crate) text_color: Color,
}

Expand Down

0 comments on commit 0ef637f

Please sign in to comment.