@@ -64,6 +64,9 @@ pub struct TimeGraph<'a> {
6464 /// The graph style.
6565 pub graph_style : Style ,
6666
67+ /// The background color
68+ pub bg_color_style : Style ,
69+
6770 /// The border style.
6871 pub border_style : Style ,
6972
@@ -150,9 +153,14 @@ impl TimeGraph<'_> {
150153 let data = graph_data. into_iter ( ) . map ( create_dataset) . collect ( ) ;
151154
152155 let block = {
153- let mut b = widget_block ( false , self . is_selected , self . border_type )
154- . border_style ( self . border_style )
155- . title_top ( Line :: styled ( self . title . as_ref ( ) , self . title_style ) ) ;
156+ let mut b = widget_block (
157+ false ,
158+ self . is_selected ,
159+ self . border_type ,
160+ self . bg_color_style ,
161+ )
162+ . border_style ( self . border_style )
163+ . title_top ( Line :: styled ( self . title . as_ref ( ) , self . title_style ) ) ;
156164
157165 if self . is_expanded {
158166 b = b. title_top ( Line :: styled ( " Esc to go back " , self . title_style ) . right_aligned ( ) )
@@ -167,8 +175,8 @@ impl TimeGraph<'_> {
167175 . x_axis ( x_axis)
168176 . y_axis ( y_axis)
169177 . marker ( self . marker )
178+ . style ( self . bg_color_style )
170179 . legend_style ( self . graph_style )
171- . style ( Style :: default ( ) . bg ( Color :: Blue ) )
172180 . legend_position ( self . legend_position )
173181 . hidden_legend_constraints (
174182 self . legend_constraints
@@ -233,6 +241,7 @@ mod test {
233241 y_bounds : AxisBound :: Max ( 100.5 ) ,
234242 y_labels : & Y_LABELS ,
235243 graph_style : Style :: default ( ) . fg ( Color :: Red ) ,
244+ bg_color_style : Style :: default ( ) . bg ( Color :: Black ) ,
236245 border_style : Style :: default ( ) . fg ( Color :: Blue ) ,
237246 border_type : BorderType :: Plain ,
238247 is_selected : false ,
0 commit comments