From e61f6204cc057bd8a47c77bd53c6efc4207a4ae9 Mon Sep 17 00:00:00 2001 From: Floyd Wang Date: Thu, 27 Feb 2025 11:14:28 +0800 Subject: [PATCH] calendar: Differentiate text color of disabled and non-current month (#668) | Before | After | | - | - | | image | image | --- crates/story/src/calendar_story.rs | 6 +++++- crates/ui/src/time/calendar.rs | 8 ++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/crates/story/src/calendar_story.rs b/crates/story/src/calendar_story.rs index 94b83ebe..f6ec6c36 100644 --- a/crates/story/src/calendar_story.rs +++ b/crates/story/src/calendar_story.rs @@ -96,7 +96,11 @@ impl CalendarStory { window, cx, ); - picker.set_date(now, window, cx); + picker.set_date( + now.checked_sub_days(Days::new(1)).unwrap_or_default(), + window, + cx, + ); picker }); let date_picker_small = cx.new(|cx| { diff --git a/crates/ui/src/time/calendar.rs b/crates/ui/src/time/calendar.rs index df02a676..6200441b 100644 --- a/crates/ui/src/time/calendar.rs +++ b/crates/ui/src/time/calendar.rs @@ -161,7 +161,7 @@ pub enum Matcher { /// Match declare days of the week. /// /// Matcher::DayOfWeek(vec![0, 6]) - /// @ill match the days of the week that are Sunday and Saturday. + /// Will match the days of the week that are Sunday and Saturday. DayOfWeek(Vec), /// Match the included days, except for those before and after the interval. /// @@ -481,7 +481,11 @@ impl Calendar { } }) .when(muted, |this| { - this.text_color(cx.theme().muted_foreground.opacity(0.3)) + this.text_color(if disabled { + cx.theme().muted_foreground.opacity(0.3) + } else { + cx.theme().muted_foreground + }) }) .when(secondary_active, |this| { this.bg(if muted {