teksilo_core/styles/
chart_style.rs1use teksilo_tokens::Color;
12
13use crate::styles::{BorderRecipe, FillRecipe, Theme};
14
15#[derive(Clone, Copy, Debug)]
16pub struct ChartFillContext<'a> {
17 pub series_index: usize,
18 pub resolved_color: Color,
19 pub theme: &'a Theme,
20}
21
22pub trait ChartStyle: 'static {
23 fn bar_fill(&self, cfg: &ChartFillContext) -> FillRecipe;
24 fn area_fill(&self, cfg: &ChartFillContext, opacity: f32) -> FillRecipe;
25 fn donut_fill(&self, cfg: &ChartFillContext) -> FillRecipe;
26 fn gridline(&self, theme: &Theme) -> BorderRecipe;
27}
28
29pub type SharedChartStyle = std::rc::Rc<dyn ChartStyle>;