Record FAB paints with accent (primary); Material3 default primaryContainer muted it

- Theme: derive primaryContainer from accent in both schemes (other container-tinted surfaces follow accent now)
- Home FAB: explicit containerColor=primary so button color == accent_color exactly
- Settings: hide 'Reset to default' on non-editable settings (App version showed it and threw 'not editable')
This commit is contained in:
avi 2026-09-17 22:06:38 -05:00
commit 9c866c858b
3 changed files with 16 additions and 3 deletions

View file

@ -122,6 +122,8 @@ fun HomeScreen(
}
}
},
containerColor = MaterialTheme.colorScheme.primary,
contentColor = MaterialTheme.colorScheme.onPrimary,
icon = { Icon(Icons.Filled.Mic, contentDescription = null) },
text = {
Text(if (recorderState.phase == com.shonar.recording.RecordingSnapshot.Phase.IDLE) "Record" else "Stop")

View file

@ -257,8 +257,10 @@ private fun Control(
}.isFailure,
supportingText = {
Row {
TextButton(onClick = onReset, contentPadding = androidx.compose.foundation.layout.PaddingValues(0.dp)) {
Text("Reset to default")
if (def.editable) {
TextButton(onClick = onReset, contentPadding = androidx.compose.foundation.layout.PaddingValues(0.dp)) {
Text("Reset to default")
}
}
}
},
@ -378,7 +380,9 @@ private fun Control(
)
}
}
TextButton(onClick = onReset) { Text("Reset") }
if (def.editable) {
TextButton(onClick = onReset) { Text("Reset") }
}
}
}
}

View file

@ -12,6 +12,7 @@ import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.lerp
import androidx.compose.ui.graphics.luminance
import com.shonar.settings.SettingsManager
@ -27,6 +28,10 @@ private fun schemeFor(accent: Color, dark: Boolean) = if (dark) {
primary = accent,
onPrimary = if (accent.luminance() > 0.4) Ink else Color.White,
secondary = accent.copy(alpha = 0.8f),
// FABs (the mic button) paint with primaryContainer, not primary —
// derive it from the accent so accent_color actually changes them.
primaryContainer = lerp(NavySurface, accent, 0.35f),
onPrimaryContainer = if (accent.luminance() > 0.4) Ink else Color.White,
background = DeepNavy,
surface = NavySurface,
onBackground = Color(0xFFE6EDF3),
@ -37,6 +42,8 @@ private fun schemeFor(accent: Color, dark: Boolean) = if (dark) {
primary = accent,
onPrimary = if (accent.luminance() > 0.4) Ink else Color.White,
secondary = accent.copy(alpha = 0.8f),
primaryContainer = lerp(Color.White, accent, 0.35f),
onPrimaryContainer = if (accent.luminance() > 0.4) Ink else Color.White,
)
}