Use primaryContainer colors when today is also selected

Distinguish the selected-today state from regular selection by using
primaryContainer/onPrimaryContainer instead of primary/onPrimary,
providing a softer visual treatment for the combined state.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
xfy 2026-05-14 17:53:33 +08:00
parent de8cb4334b
commit bacc2bc8dc

View File

@ -37,6 +37,7 @@ fun DayCell(
modifier: Modifier = Modifier modifier: Modifier = Modifier
) { ) {
val contentColor = when { val contentColor = when {
isSelected && isToday -> MaterialTheme.colorScheme.onPrimaryContainer
isSelected -> MaterialTheme.colorScheme.onPrimary isSelected -> MaterialTheme.colorScheme.onPrimary
isToday -> MaterialTheme.colorScheme.primary isToday -> MaterialTheme.colorScheme.primary
!isCurrentMonth -> MaterialTheme.colorScheme.onSurface.copy(alpha = 0.38f) !isCurrentMonth -> MaterialTheme.colorScheme.onSurface.copy(alpha = 0.38f)
@ -49,6 +50,7 @@ fun DayCell(
.clip(CircleShape) .clip(CircleShape)
.then( .then(
when { when {
isSelected && isToday -> Modifier.background(MaterialTheme.colorScheme.primaryContainer)
isSelected -> Modifier.background(MaterialTheme.colorScheme.primary) isSelected -> Modifier.background(MaterialTheme.colorScheme.primary)
isToday -> Modifier.border(BorderStroke(1.5.dp, MaterialTheme.colorScheme.primary), CircleShape) isToday -> Modifier.border(BorderStroke(1.5.dp, MaterialTheme.colorScheme.primary), CircleShape)
else -> Modifier else -> Modifier