Open gweisert opened 2 months ago
This should work, the current implementation doesn't support setting the color BUT it works with light and dark mode - your implementation doesn't work with light and dark mode as it is always the same color https://github.com/emilk/egui_plot/blob/0fe0ea6cbf0fe01f2b27f9247516fc63dbb25b0f/egui_plot/src/items/mod.rs#L1939
@bircni I'm not quite sure what you are trying to say. If no custom ruler color is specified, the function you mentioned is still used to determine the color:
// before
let line_color = rulers_color(ui);
// now
let line_color = self.ruler_color.unwrap_or_else(|| rulers_color(ui));
Sure I wanted to say that it might be better to set two colors, one for dark and one for light. Sorry that was kinda weird how I wrote that
That seems really unnecessary to me. If that is your use case, you can easily choose the color beforehand:
let my_color = if ui.visuals().dark_mode { Color32::RED } else { Color32::GREEN };
egui_plot::Plot::new("my_plot").custom_ruler_color(my_color).show( [...] )
Implement custom ruler color for Plot which is exposed through the new
custom_ruler_color
method. The entire thing is only a few lines.