@@ -96,8 +96,6 @@ pub enum SelectedTab {
9696 #[ default]
9797 #[ strum( to_string = "General Information" ) ]
9898 General ,
99- // #[strum(to_string = "Index")]
100- // Index,
10199 #[ strum( to_string = "Process Group Info" ) ]
102100 ProcessGroup ,
103101 #[ strum( to_string = "Process Info" ) ]
@@ -169,11 +167,15 @@ impl Default for App<'_> {
169167
170168impl App < ' _ > {
171169 /// Constructs a new instance of [`App`].
172- pub fn new ( filepath : String ) -> Self {
170+ pub fn new ( filepath : String , colors : Option < CommonColors > ) -> Self {
173171 let now = Instant :: now ( ) ;
174172 let parser = parser:: CDParser :: new ( & filepath) . unwrap ( ) ;
175173 let mut ret = Self :: default ( ) ;
174+
176175 ret. filepath = filepath. clone ( ) ;
176+ if let Some ( colors) = colors {
177+ ret. colors = colors;
178+ }
177179
178180 ret. index_map = parser. build_index ( ) . unwrap ( ) ;
179181 ret. crash_dump = parser. parse ( & ret. index_map ) . unwrap ( ) ;
@@ -455,17 +457,17 @@ impl App<'_> {
455457
456458 pub fn get_heap_info ( & self , pid : & str ) -> io:: Result < Text > {
457459 self . parser
458- . get_heap_info ( & self . crash_dump , & self . filepath , pid)
460+ . get_heap_info ( & self . crash_dump , & self . filepath , pid, & self . colors )
459461 }
460462
461463 pub fn get_stack_info ( & self , pid : & str ) -> io:: Result < Text > {
462464 self . parser
463- . get_stack_info ( & self . crash_dump , & self . filepath , pid)
465+ . get_stack_info ( & self . crash_dump , & self . filepath , pid, & self . colors )
464466 }
465467
466468 pub fn get_message_queue_info ( & self , pid : & str ) -> io:: Result < Text > {
467469 self . parser
468- . get_message_queue_info ( & self . crash_dump , & self . filepath , pid)
470+ . get_message_queue_info ( & self . crash_dump , & self . filepath , pid, & self . colors )
469471 }
470472}
471473
@@ -583,7 +585,7 @@ impl Widget for &mut App<'_> {
583585 ) ,
584586 ] ) )
585587 . border_style ( Style :: default ( ) . fg ( self . colors . border_color ) )
586- . style ( Style :: default ( ) . bg ( Color :: Black ) ) ;
588+ . style ( Style :: default ( ) . bg ( self . colors . background_color ) ) ;
587589
588590 let paragraph = Paragraph :: new ( help_text)
589591 . block ( block)
@@ -656,29 +658,29 @@ impl SelectedTab {
656658 let memory_information_header = Line :: from ( vec ! [
657659 Span :: styled(
658660 "Memory Information:" ,
659- Style :: default ( ) . fg( app. colors. header_text ) ,
661+ Style :: default ( ) . fg( app. colors. info_preamble ) ,
660662 ) ,
661663 Span :: raw( "\n " ) ,
662664 ] ) ;
663665
664666 let process_count = Line :: from ( vec ! [
665- Span :: styled( "Process Count: " , Style :: default ( ) . fg( app. colors. info_text ) ) ,
667+ Span :: styled( "Process Count: " , Style :: default ( ) . fg( app. colors. info_preamble ) ) ,
666668 Span :: styled(
667669 process_count. to_string( ) ,
668670 Style :: default ( ) . fg( app. colors. default_text) ,
669671 ) ,
670672 ] ) ;
671673
672674 let ets_count = Line :: from ( vec ! [
673- Span :: styled( "ETS Tables: " , Style :: default ( ) . fg( app. colors. info_text ) ) ,
675+ Span :: styled( "ETS Tables: " , Style :: default ( ) . fg( app. colors. info_preamble ) ) ,
674676 Span :: styled(
675677 ets_count. to_string( ) ,
676678 Style :: default ( ) . fg( app. colors. default_text) ,
677679 ) ,
678680 ] ) ;
679681
680682 let fn_count = Line :: from ( vec ! [
681- Span :: styled( "Funs: " , Style :: default ( ) . fg( app. colors. info_text ) ) ,
683+ Span :: styled( "Funs: " , Style :: default ( ) . fg( app. colors. info_preamble ) ) ,
682684 Span :: styled(
683685 fn_count. to_string( ) ,
684686 Style :: default ( ) . fg( app. colors. default_text) ,
@@ -753,7 +755,7 @@ impl SelectedTab {
753755 InfoOrIndex :: Info ( ref proc_info) => {
754756 let proc_info: & types:: ProcInfo = proc_info;
755757 active_proc_info = proc_info. clone ( ) ;
756- active_proc_info. format_as_ratatui_text ( )
758+ active_proc_info. format_as_ratatui_text ( & app . colors )
757759 }
758760 InfoOrIndex :: Index ( _) => {
759761 Text :: raw ( format ! ( "Index for pid: {:?}" , selected_pid) . to_string ( ) )
@@ -832,7 +834,7 @@ impl SelectedTab {
832834 InfoOrIndex :: Info ( ref proc_info) => {
833835 let proc_info: & types:: ProcInfo = proc_info;
834836 active_proc_info = proc_info. clone ( ) ;
835- active_proc_info. format_as_ratatui_text ( )
837+ active_proc_info. format_as_ratatui_text ( & app . colors )
836838 }
837839 InfoOrIndex :: Index ( _) => {
838840 Text :: raw ( format ! ( "Index for pid: {:?}" , selected_pid) . to_string ( ) )
0 commit comments