@@ -523,52 +523,52 @@ class AlternatingRowGrid(FancyGrid):
523523
524524 This typically looks quite good, but also does a good job of conserving vertical space.
525525 """
526- def __init__ (self , bg_reset : str = TableColors .BG_RESET , bg_color : str = TableColors .BG_COLOR_ROW ) -> None :
526+ def __init__ (self , bg_primary : str = TableColors .BG_RESET , bg_alternate : str = TableColors .BG_COLOR_ROW ) -> None :
527527 """Initialize the AlternatingRowGrid with the two alternating colors.
528528
529- :param bg_reset : string reprsenting the default background color
530- :param bg_color : string representing the alternate background color
529+ :param bg_primary : string reprsenting the primary background color starting with the 1st row
530+ :param bg_alternate : string representing the alternate background color starting with the 2nd row
531531 """
532532 super ().__init__ ()
533533 # Disable row dividers present in FancyGrid in order to save vertical space
534534 self .row_divider = False
535535 self .row_divider_span = ''
536536 self .row_divider_col_divider = ''
537537 self .row_divider_header_col_divider = ''
538- self .bg_reset = bg_reset
539- self .bg_color = bg_color
538+ self .bg_reset = TableColors .BG_RESET
539+ self .bg_primary = bg_primary
540+ self .bg_alt = bg_alternate
540541
541542 def border_left_span (self , row_index : Union [int , None ]) -> str :
543+ prefix = self .bg_reset + '║'
544+ color = self .bg_reset
542545 if isinstance (row_index , int ):
543546 if row_index % 2 == 0 :
544- return '║'
547+ color = self . bg_primary
545548 else :
546- return self . bg_reset + '║' + self .bg_color
547- return '║'
549+ color = self .bg_alt
550+ return prefix + color
548551
549552 def border_right_span (self , row_index : Union [int , None ]) -> str :
550- if isinstance (row_index , int ):
551- if row_index % 2 == 0 :
552- return '║'
553- else :
554- return self .bg_reset + '║'
555- return '║'
553+ return self .bg_reset + '║'
556554
557555 def col_divider_span (self , row_index : Union [int , None ]) -> str :
556+ color = self .bg_reset
558557 if isinstance (row_index , int ):
559558 if row_index % 2 == 0 :
560- return '│'
559+ color = self . bg_primary
561560 else :
562- return self . bg_reset + self .bg_color + '│'
563- return '│'
561+ color = self .bg_alt
562+ return color + '│'
564563
565564 def header_col_divider_span (self , row_index : Union [int , None ]) -> str :
565+ color = self .bg_reset
566566 if isinstance (row_index , int ):
567567 if row_index % 2 == 0 :
568- return '║'
568+ color = self . bg_primary
569569 else :
570- return self . bg_reset + self .bg_color + '║'
571- return '║'
570+ color = self .bg_alt
571+ return color + '║'
572572
573573
574574DEFAULT_GRID = AlternatingRowGrid ()
0 commit comments