@@ -653,6 +653,11 @@ fn render_week_availability(
653653) {
654654 let start_row = 10u16 ; // Below the calendar grid
655655 let monday = get_week_monday ( selected_date) ;
656+ let today = Local :: now ( ) . date_naive ( ) ;
657+ let current_minutes = {
658+ let now = Local :: now ( ) . time ( ) ;
659+ now. hour ( ) * 60 + now. minute ( )
660+ } ;
656661 let num_days = if show_weekends { 7 } else { 5 } ;
657662
658663 // Header row
@@ -698,16 +703,34 @@ fn render_week_availability(
698703 let first_half_busy = first_half_count > 0 ;
699704 let second_half_busy = second_half_count > 0 ;
700705
701- let color_for = |count : usize | -> Color {
702- if count >= 2 { colors:: OVERLAP_EVENT } else { colors:: BUSY_BLOCK }
706+ let is_past_day = date < today;
707+ let first_half_past = is_past_day || ( date == today && current_minutes >= slot1_end) ;
708+ let second_half_past = is_past_day || ( date == today && current_minutes >= slot2_end) ;
709+
710+ let dim = |color : Color | -> Color {
711+ match color {
712+ Color :: Blue => Color :: Rgb { r : 90 , g : 90 , b : 170 } ,
713+ Color :: Red => Color :: Rgb { r : 170 , g : 75 , b : 75 } ,
714+ Color :: Rgb { r : 200 , g : 200 , b : 200 } => Color :: Rgb { r : 150 , g : 150 , b : 150 } ,
715+ other => other,
716+ }
717+ } ;
718+
719+ let color_for = |count : usize , past : bool | -> Color {
720+ let c = if count >= 2 { colors:: OVERLAP_EVENT } else { colors:: BUSY_BLOCK } ;
721+ if past { dim ( c) } else { c }
722+ } ;
723+
724+ let free_color = |past : bool | -> Color {
725+ if past { dim ( colors:: FREE_BLOCK ) } else { colors:: FREE_BLOCK }
703726 } ;
704727
705728 // Vertical half-blocks: top = first 30 min, bottom = second 30 min
706729 // ▀ draws top with fg, bottom with bg
707730 match ( first_half_busy, second_half_busy) {
708731 ( true , true ) => {
709- let top = color_for ( first_half_count) ;
710- let bot = color_for ( second_half_count) ;
732+ let top = color_for ( first_half_count, first_half_past ) ;
733+ let bot = color_for ( second_half_count, second_half_past ) ;
711734 if top == bot {
712735 execute ! ( out, SetForegroundColor ( top) ) . unwrap ( ) ;
713736 print ! ( "██" ) ;
@@ -717,15 +740,15 @@ fn render_week_availability(
717740 }
718741 }
719742 ( true , false ) => {
720- execute ! ( out, SetForegroundColor ( color_for( first_half_count) ) , SetBackgroundColor ( colors :: FREE_BLOCK ) ) . unwrap ( ) ;
743+ execute ! ( out, SetForegroundColor ( color_for( first_half_count, first_half_past ) ) , SetBackgroundColor ( free_color ( second_half_past ) ) ) . unwrap ( ) ;
721744 print ! ( "▀▀" ) ;
722745 }
723746 ( false , true ) => {
724- execute ! ( out, SetForegroundColor ( colors :: FREE_BLOCK ) , SetBackgroundColor ( color_for( second_half_count) ) ) . unwrap ( ) ;
747+ execute ! ( out, SetForegroundColor ( free_color ( first_half_past ) ) , SetBackgroundColor ( color_for( second_half_count, second_half_past ) ) ) . unwrap ( ) ;
725748 print ! ( "▀▀" ) ;
726749 }
727750 ( false , false ) => {
728- execute ! ( out, SetForegroundColor ( colors :: FREE_BLOCK ) ) . unwrap ( ) ;
751+ execute ! ( out, SetForegroundColor ( free_color ( first_half_past ) ) ) . unwrap ( ) ;
729752 print ! ( "██" ) ;
730753 }
731754 }
0 commit comments