Audit: hardcoded Color.* → MaterialTheme.colorScheme (dark-mode parity)

Replaces ~31 literal Color.White / Color.Red / Color.Gray / Color(0x…)
usages in production screens with theme-aware colorScheme roles. Fixes
dark-mode regressions on those surfaces.

Covers: DocumentCard, DocumentStates, DocumentDetailScreen,
ContractorDetailScreen (delete/favorite tints), AddContractorDialog
(FilterChip, Switch, dialog container).

Overlay-specific Color.Black/Color.White (e.g., photo-grid darkening
overlay) and theme-defined brand tokens (OrganicDesign, ThemeColors)
are left untouched per spec.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Trey T
2026-04-18 18:11:59 -05:00
parent d49bc719b2
commit a1f366cb30
5 changed files with 31 additions and 31 deletions

View File

@@ -321,8 +321,8 @@ fun AddContractorDialog(
}, },
label = { Text(specialty.name) }, label = { Text(specialty.name) },
colors = FilterChipDefaults.filterChipColors( colors = FilterChipDefaults.filterChipColors(
selectedContainerColor = Color(0xFF3B82F6), selectedContainerColor = MaterialTheme.colorScheme.primary,
selectedLabelColor = Color.White selectedLabelColor = MaterialTheme.colorScheme.onPrimary
) )
) )
} }
@@ -438,8 +438,8 @@ fun AddContractorDialog(
checked = isFavorite, checked = isFavorite,
onCheckedChange = { isFavorite = it }, onCheckedChange = { isFavorite = it },
colors = SwitchDefaults.colors( colors = SwitchDefaults.colors(
checkedThumbColor = Color.White, checkedThumbColor = MaterialTheme.colorScheme.onPrimary,
checkedTrackColor = Color(0xFF3B82F6) checkedTrackColor = MaterialTheme.colorScheme.primary
) )
) )
} }
@@ -511,7 +511,7 @@ fun AddContractorDialog(
if (createState is ApiResult.Loading || updateState is ApiResult.Loading) { if (createState is ApiResult.Loading || updateState is ApiResult.Loading) {
CircularProgressIndicator( CircularProgressIndicator(
modifier = Modifier.size(20.dp), modifier = Modifier.size(20.dp),
color = Color.White, color = MaterialTheme.colorScheme.onPrimary,
strokeWidth = 2.dp strokeWidth = 2.dp
) )
} else { } else {
@@ -527,7 +527,7 @@ fun AddContractorDialog(
Text(cancelText, color = Color(0xFF6B7280)) Text(cancelText, color = Color(0xFF6B7280))
} }
}, },
containerColor = Color.White, containerColor = MaterialTheme.colorScheme.surface,
shape = RoundedCornerShape(AppRadius.lg) shape = RoundedCornerShape(AppRadius.lg)
) )
} }

View File

@@ -69,7 +69,7 @@ private fun WarrantyCardContent(document: Document, onClick: () -> Unit) {
Text( Text(
itemName, itemName,
style = MaterialTheme.typography.bodyMedium, style = MaterialTheme.typography.bodyMedium,
color = Color.Gray, color = MaterialTheme.colorScheme.onSurfaceVariant,
maxLines = 1, maxLines = 1,
overflow = TextOverflow.Ellipsis overflow = TextOverflow.Ellipsis
) )
@@ -102,11 +102,11 @@ private fun WarrantyCardContent(document: Document, onClick: () -> Unit) {
horizontalArrangement = Arrangement.SpaceBetween horizontalArrangement = Arrangement.SpaceBetween
) { ) {
Column { Column {
Text("Provider", style = MaterialTheme.typography.labelSmall, color = Color.Gray) Text("Provider", style = MaterialTheme.typography.labelSmall, color = MaterialTheme.colorScheme.onSurfaceVariant)
Text(document.provider ?: "N/A", style = MaterialTheme.typography.bodyMedium, fontWeight = FontWeight.Medium) Text(document.provider ?: "N/A", style = MaterialTheme.typography.bodyMedium, fontWeight = FontWeight.Medium)
} }
Column(horizontalAlignment = Alignment.End) { Column(horizontalAlignment = Alignment.End) {
Text("Expires", style = MaterialTheme.typography.labelSmall, color = Color.Gray) Text("Expires", style = MaterialTheme.typography.labelSmall, color = MaterialTheme.colorScheme.onSurfaceVariant)
Text(document.endDate ?: "N/A", style = MaterialTheme.typography.bodyMedium, fontWeight = FontWeight.Medium) Text(document.endDate ?: "N/A", style = MaterialTheme.typography.bodyMedium, fontWeight = FontWeight.Medium)
} }
} }
@@ -195,7 +195,7 @@ private fun RegularDocumentCardContent(document: Document, onClick: () -> Unit)
Text( Text(
document.description, document.description,
style = MaterialTheme.typography.bodySmall, style = MaterialTheme.typography.bodySmall,
color = Color.Gray, color = MaterialTheme.colorScheme.onSurfaceVariant,
maxLines = 2, maxLines = 2,
overflow = TextOverflow.Ellipsis overflow = TextOverflow.Ellipsis
) )
@@ -231,7 +231,7 @@ private fun RegularDocumentCardContent(document: Document, onClick: () -> Unit)
Icon( Icon(
Icons.Default.ChevronRight, Icons.Default.ChevronRight,
contentDescription = null, // decorative contentDescription = null, // decorative
tint = Color.Gray tint = MaterialTheme.colorScheme.onSurfaceVariant
) )
} }
} }

View File

@@ -22,9 +22,9 @@ fun EmptyState(
horizontalAlignment = Alignment.CenterHorizontally, horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.Center verticalArrangement = Arrangement.Center
) { ) {
Icon(icon, contentDescription = null, modifier = Modifier.size(64.dp) , tint = Color.Gray) // decorative Icon(icon, contentDescription = null, modifier = Modifier.size(64.dp) , tint = MaterialTheme.colorScheme.onSurfaceVariant) // decorative
Spacer(modifier = Modifier.height(16.dp)) Spacer(modifier = Modifier.height(16.dp))
Text(message, style = MaterialTheme.typography.titleMedium, color = Color.Gray) Text(message, style = MaterialTheme.typography.titleMedium, color = MaterialTheme.colorScheme.onSurfaceVariant)
} }
} }
@@ -35,9 +35,9 @@ fun ErrorState(message: String, onRetry: () -> Unit) {
horizontalAlignment = Alignment.CenterHorizontally, horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.Center verticalArrangement = Arrangement.Center
) { ) {
Icon(Icons.Default.Error, contentDescription = "Error", modifier = Modifier.size(64.dp) , tint = Color.Red) Icon(Icons.Default.Error, contentDescription = "Error", modifier = Modifier.size(64.dp) , tint = MaterialTheme.colorScheme.error)
Spacer(modifier = Modifier.height(16.dp)) Spacer(modifier = Modifier.height(16.dp))
Text(message, style = MaterialTheme.typography.bodyLarge, color = Color.Gray) Text(message, style = MaterialTheme.typography.bodyLarge, color = MaterialTheme.colorScheme.onSurfaceVariant)
Spacer(modifier = Modifier.height(16.dp)) Spacer(modifier = Modifier.height(16.dp))
OutlinedButton(onClick = onRetry) { OutlinedButton(onClick = onRetry) {
Text("Retry") Text("Retry")

View File

@@ -113,7 +113,7 @@ fun ContractorDetailScreen(
Icon( Icon(
if (state.data.isFavorite) Icons.Default.Star else Icons.Default.StarOutline, if (state.data.isFavorite) Icons.Default.Star else Icons.Default.StarOutline,
stringResource(Res.string.contractors_toggle_favorite), stringResource(Res.string.contractors_toggle_favorite),
tint = if (state.data.isFavorite) Color(0xFFF59E0B) else LocalContentColor.current tint = if (state.data.isFavorite) MaterialTheme.colorScheme.tertiary else LocalContentColor.current
) )
} }
IconButton( IconButton(
@@ -126,7 +126,7 @@ fun ContractorDetailScreen(
onClick = { showDeleteConfirmation = true }, onClick = { showDeleteConfirmation = true },
modifier = Modifier.testTag(AccessibilityIds.Contractor.deleteButton) modifier = Modifier.testTag(AccessibilityIds.Contractor.deleteButton)
) { ) {
Icon(Icons.Default.Delete, stringResource(Res.string.common_delete), tint = Color(0xFFEF4444)) Icon(Icons.Default.Delete, stringResource(Res.string.common_delete), tint = MaterialTheme.colorScheme.error)
} }
} }
else -> {} else -> {}
@@ -238,7 +238,7 @@ fun ContractorDetailScreen(
if (index < contractor.rating.toInt()) Icons.Default.Star else Icons.Default.StarOutline, if (index < contractor.rating.toInt()) Icons.Default.Star else Icons.Default.StarOutline,
contentDescription = null, // decorative contentDescription = null, // decorative
modifier = Modifier.size(20.dp), modifier = Modifier.size(20.dp),
tint = Color(0xFFF59E0B) tint = MaterialTheme.colorScheme.tertiary
) )
} }
Spacer(modifier = Modifier.width(OrganicSpacing.small)) Spacer(modifier = Modifier.width(OrganicSpacing.small))
@@ -306,7 +306,7 @@ fun ContractorDetailScreen(
QuickActionButton( QuickActionButton(
icon = Icons.Default.Language, icon = Icons.Default.Language,
label = stringResource(Res.string.contractors_website), label = stringResource(Res.string.contractors_website),
color = Color(0xFFF59E0B), color = MaterialTheme.colorScheme.tertiary,
modifier = Modifier.weight(1f), modifier = Modifier.weight(1f),
onClick = { onClick = {
try { try {
@@ -321,7 +321,7 @@ fun ContractorDetailScreen(
QuickActionButton( QuickActionButton(
icon = Icons.Default.Map, icon = Icons.Default.Map,
label = stringResource(Res.string.contractors_directions), label = stringResource(Res.string.contractors_directions),
color = Color(0xFFEF4444), color = MaterialTheme.colorScheme.error,
modifier = Modifier.weight(1f), modifier = Modifier.weight(1f),
onClick = { onClick = {
try { try {
@@ -376,7 +376,7 @@ fun ContractorDetailScreen(
icon = Icons.Default.Language, icon = Icons.Default.Language,
label = stringResource(Res.string.contractors_website), label = stringResource(Res.string.contractors_website),
value = website, value = website,
iconTint = Color(0xFFF59E0B), iconTint = MaterialTheme.colorScheme.tertiary,
onClick = { onClick = {
try { try {
val url = if (website.startsWith("http")) website else "https://$website" val url = if (website.startsWith("http")) website else "https://$website"
@@ -422,7 +422,7 @@ fun ContractorDetailScreen(
icon = Icons.Default.LocationOn, icon = Icons.Default.LocationOn,
label = stringResource(Res.string.contractors_location), label = stringResource(Res.string.contractors_location),
value = fullAddress, value = fullAddress,
iconTint = Color(0xFFEF4444), iconTint = MaterialTheme.colorScheme.error,
onClick = { onClick = {
try { try {
val address = listOfNotNull( val address = listOfNotNull(
@@ -469,7 +469,7 @@ fun ContractorDetailScreen(
Icons.Default.Notes, Icons.Default.Notes,
contentDescription = null, // decorative contentDescription = null, // decorative
modifier = Modifier.size(20.dp), modifier = Modifier.size(20.dp),
tint = Color(0xFFF59E0B) tint = MaterialTheme.colorScheme.tertiary
) )
Text( Text(
text = contractor.notes, text = contractor.notes,
@@ -502,7 +502,7 @@ fun ContractorDetailScreen(
icon = Icons.Default.Star, icon = Icons.Default.Star,
value = ((contractor.rating * 10).toInt() / 10.0).toString(), value = ((contractor.rating * 10).toInt() / 10.0).toString(),
label = stringResource(Res.string.contractors_average_rating), label = stringResource(Res.string.contractors_average_rating),
color = Color(0xFFF59E0B) color = MaterialTheme.colorScheme.tertiary
) )
} }
} }
@@ -550,7 +550,7 @@ fun ContractorDetailScreen(
if (showDeleteConfirmation) { if (showDeleteConfirmation) {
AlertDialog( AlertDialog(
onDismissRequest = { showDeleteConfirmation = false }, onDismissRequest = { showDeleteConfirmation = false },
icon = { Icon(Icons.Default.Warning, null, tint = Color(0xFFEF4444)) }, icon = { Icon(Icons.Default.Warning, null, tint = MaterialTheme.colorScheme.error) },
title = { Text(stringResource(Res.string.contractors_delete)) }, title = { Text(stringResource(Res.string.contractors_delete)) },
text = { Text(stringResource(Res.string.contractors_delete_warning)) }, text = { Text(stringResource(Res.string.contractors_delete_warning)) },
confirmButton = { confirmButton = {
@@ -559,7 +559,7 @@ fun ContractorDetailScreen(
viewModel.deleteContractor(contractorId) viewModel.deleteContractor(contractorId)
showDeleteConfirmation = false showDeleteConfirmation = false
}, },
colors = ButtonDefaults.buttonColors(containerColor = Color(0xFFEF4444)) colors = ButtonDefaults.buttonColors(containerColor = MaterialTheme.colorScheme.error)
) { ) {
Text(stringResource(Res.string.common_delete)) Text(stringResource(Res.string.common_delete))
} }

View File

@@ -102,7 +102,7 @@ fun DocumentDetailScreen(
modifier = Modifier.testTag(AccessibilityIds.Document.deleteButton), modifier = Modifier.testTag(AccessibilityIds.Document.deleteButton),
onClick = { showDeleteDialog = true } onClick = { showDeleteDialog = true }
) { ) {
Icon(Icons.Default.Delete, stringResource(Res.string.common_delete), tint = Color.Red) Icon(Icons.Default.Delete, stringResource(Res.string.common_delete), tint = MaterialTheme.colorScheme.error)
} }
} }
else -> {} else -> {}
@@ -156,7 +156,7 @@ fun DocumentDetailScreen(
Text( Text(
stringResource(Res.string.documents_status), stringResource(Res.string.documents_status),
style = MaterialTheme.typography.labelMedium, style = MaterialTheme.typography.labelMedium,
color = Color.Gray color = MaterialTheme.colorScheme.onSurfaceVariant
) )
Text( Text(
when { when {
@@ -175,7 +175,7 @@ fun DocumentDetailScreen(
Text( Text(
stringResource(Res.string.documents_days_remaining), stringResource(Res.string.documents_days_remaining),
style = MaterialTheme.typography.labelMedium, style = MaterialTheme.typography.labelMedium,
color = Color.Gray color = MaterialTheme.colorScheme.onSurfaceVariant
) )
Text( Text(
"$daysUntilExpiration", "$daysUntilExpiration",
@@ -450,7 +450,7 @@ fun DocumentDetailScreen(
showDeleteDialog = false showDeleteDialog = false
} }
) { ) {
Text(stringResource(Res.string.common_delete), color = Color.Red) Text(stringResource(Res.string.common_delete), color = MaterialTheme.colorScheme.error)
} }
}, },
dismissButton = { dismissButton = {
@@ -480,7 +480,7 @@ fun DetailRow(label: String, value: String) {
Text( Text(
label, label,
style = MaterialTheme.typography.labelMedium, style = MaterialTheme.typography.labelMedium,
color = Color.Gray color = MaterialTheme.colorScheme.onSurfaceVariant
) )
Spacer(modifier = Modifier.height(OrganicSpacing.xs)) Spacer(modifier = Modifier.height(OrganicSpacing.xs))
Text( Text(