5
5
6
6
use std:: sync:: Arc ;
7
7
8
- use egui:: emath:: Rangef ;
9
- use egui:: { Color32 , NumExt as _, Rect , Shape , Tooltip , epaint:: Vertex , lerp, pos2, remap} ;
8
+ use egui:: { Color32 , NumExt as _, Rangef , Rect , Shape , Tooltip , epaint:: Vertex , lerp, pos2, remap} ;
10
9
11
10
use re_chunk_store:: Chunk ;
12
11
use re_chunk_store:: RangeQuery ;
13
12
use re_log_types:: { ComponentPath , ResolvedTimeRange , TimeInt , TimelineName } ;
13
+ use re_ui:: UiExt as _;
14
14
use re_viewer_context:: { Item , TimeControl , UiLayout , ViewerContext } ;
15
15
16
- use crate :: recursive_chunks_per_timeline_subscriber:: PathRecursiveChunksPerTimelineStoreSubscriber ;
17
- use crate :: time_panel:: TimePanelItem ;
16
+ use crate :: {
17
+ recursive_chunks_per_timeline_subscriber:: PathRecursiveChunksPerTimelineStoreSubscriber ,
18
+ time_panel:: TimePanelItem ,
19
+ } ;
18
20
19
21
use super :: time_ranges_ui:: TimeRangesUi ;
20
22
@@ -734,11 +736,22 @@ impl<'a> DensityGraphBuilder<'a> {
734
736
735
737
fn graph_color ( ctx : & ViewerContext < ' _ > , item : & Item , ui : & egui:: Ui ) -> Color32 {
736
738
let is_selected = ctx. selection ( ) . contains_item ( item) ;
737
- if is_selected {
738
- make_brighter ( ui. visuals ( ) . widgets . active . fg_stroke . color )
739
- } else {
740
- //TODO(ab): tokenize that!
741
- Color32 :: from_gray ( 225 )
739
+
740
+ match ui. theme ( ) {
741
+ egui:: Theme :: Dark => {
742
+ if is_selected {
743
+ make_brighter ( ui. visuals ( ) . widgets . active . fg_stroke . color )
744
+ } else {
745
+ Color32 :: from_gray ( 225 ) //TODO(ab): tokenize
746
+ }
747
+ }
748
+ egui:: Theme :: Light => {
749
+ if is_selected {
750
+ make_darker ( ui. visuals ( ) . widgets . active . fg_stroke . color )
751
+ } else {
752
+ Color32 :: from_gray ( 64 ) //TODO(ab): tokenize
753
+ }
754
+ }
742
755
}
743
756
}
744
757
@@ -750,3 +763,12 @@ fn make_brighter(color: Color32) -> Color32 {
750
763
b. saturating_add ( 64 ) ,
751
764
)
752
765
}
766
+
767
+ fn make_darker ( color : Color32 ) -> Color32 {
768
+ let [ r, g, b, _] = color. to_array ( ) ;
769
+ egui:: Color32 :: from_rgb (
770
+ r. saturating_sub ( 64 ) ,
771
+ g. saturating_sub ( 64 ) ,
772
+ b. saturating_sub ( 64 ) ,
773
+ )
774
+ }
0 commit comments