@@ -180,6 +180,7 @@ pub struct Plot<'a> {
180
180
x_axes : Vec < AxisHints < ' a > > , // default x axes
181
181
y_axes : Vec < AxisHints < ' a > > , // default y axes
182
182
legend_config : Option < Legend > ,
183
+ cursor_color : Option < Color32 > ,
183
184
show_background : bool ,
184
185
show_axes : Vec2b ,
185
186
@@ -227,6 +228,7 @@ impl<'a> Plot<'a> {
227
228
x_axes : vec ! [ AxisHints :: new( Axis :: X ) ] ,
228
229
y_axes : vec ! [ AxisHints :: new( Axis :: Y ) ] ,
229
230
legend_config : None ,
231
+ cursor_color : None ,
230
232
show_background : true ,
231
233
show_axes : true . into ( ) ,
232
234
@@ -713,6 +715,15 @@ impl<'a> Plot<'a> {
713
715
self
714
716
}
715
717
718
+ /// Set custom cursor color.
719
+ ///
720
+ /// You may set the color to [`Color32::TRANSPARENT`] to hide the cursors.
721
+ #[ inline]
722
+ pub fn cursor_color ( mut self , color : Color32 ) -> Self {
723
+ self . cursor_color = Some ( color) ;
724
+ self
725
+ }
726
+
716
727
/// Interact with and add items to the plot and finally draw it.
717
728
pub fn show < R > (
718
729
self ,
@@ -754,6 +765,7 @@ impl<'a> Plot<'a> {
754
765
x_axes,
755
766
y_axes,
756
767
legend_config,
768
+ cursor_color,
757
769
reset,
758
770
show_background,
759
771
show_axes,
@@ -1182,6 +1194,7 @@ impl<'a> Plot<'a> {
1182
1194
draw_cursor_x : linked_cursors. as_ref ( ) . map_or ( false , |group| group. 1 . x ) ,
1183
1195
draw_cursor_y : linked_cursors. as_ref ( ) . map_or ( false , |group| group. 1 . y ) ,
1184
1196
draw_cursors,
1197
+ cursor_color,
1185
1198
grid_spacers,
1186
1199
sharp_grid_lines,
1187
1200
clamp_grid,
@@ -1472,6 +1485,7 @@ struct PreparedPlot<'a> {
1472
1485
draw_cursor_x : bool ,
1473
1486
draw_cursor_y : bool ,
1474
1487
draw_cursors : Vec < Cursor > ,
1488
+ cursor_color : Option < Color32 > ,
1475
1489
1476
1490
sharp_grid_lines : bool ,
1477
1491
clamp_grid : bool ,
@@ -1513,7 +1527,7 @@ impl<'a> PreparedPlot<'a> {
1513
1527
} ;
1514
1528
1515
1529
// Draw cursors
1516
- let line_color = rulers_color ( ui) ;
1530
+ let line_color = self . cursor_color . unwrap_or_else ( || rulers_color ( ui) ) ;
1517
1531
1518
1532
let mut draw_cursor = |cursors : & Vec < Cursor > , always| {
1519
1533
for & cursor in cursors {
0 commit comments