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:
parent
b6d4fd3cb2
commit
9c866c858b
3 changed files with 16 additions and 3 deletions
|
|
@ -122,6 +122,8 @@ fun HomeScreen(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
containerColor = MaterialTheme.colorScheme.primary,
|
||||||
|
contentColor = MaterialTheme.colorScheme.onPrimary,
|
||||||
icon = { Icon(Icons.Filled.Mic, contentDescription = null) },
|
icon = { Icon(Icons.Filled.Mic, contentDescription = null) },
|
||||||
text = {
|
text = {
|
||||||
Text(if (recorderState.phase == com.shonar.recording.RecordingSnapshot.Phase.IDLE) "Record" else "Stop")
|
Text(if (recorderState.phase == com.shonar.recording.RecordingSnapshot.Phase.IDLE) "Record" else "Stop")
|
||||||
|
|
|
||||||
|
|
@ -257,10 +257,12 @@ private fun Control(
|
||||||
}.isFailure,
|
}.isFailure,
|
||||||
supportingText = {
|
supportingText = {
|
||||||
Row {
|
Row {
|
||||||
|
if (def.editable) {
|
||||||
TextButton(onClick = onReset, contentPadding = androidx.compose.foundation.layout.PaddingValues(0.dp)) {
|
TextButton(onClick = onReset, contentPadding = androidx.compose.foundation.layout.PaddingValues(0.dp)) {
|
||||||
Text("Reset to default")
|
Text("Reset to default")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
modifier = Modifier.fillMaxWidth(),
|
modifier = Modifier.fillMaxWidth(),
|
||||||
)
|
)
|
||||||
|
|
@ -378,10 +380,12 @@ private fun Control(
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (def.editable) {
|
||||||
TextButton(onClick = onReset) { Text("Reset") }
|
TextButton(onClick = onReset) { Text("Reset") }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun encodeString(s: String): String =
|
private fun encodeString(s: String): String =
|
||||||
JsonPrimitive(s).toString()
|
JsonPrimitive(s).toString()
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ import androidx.compose.runtime.mutableStateOf
|
||||||
import androidx.compose.runtime.remember
|
import androidx.compose.runtime.remember
|
||||||
import androidx.compose.runtime.setValue
|
import androidx.compose.runtime.setValue
|
||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
|
import androidx.compose.ui.graphics.lerp
|
||||||
import androidx.compose.ui.graphics.luminance
|
import androidx.compose.ui.graphics.luminance
|
||||||
import com.shonar.settings.SettingsManager
|
import com.shonar.settings.SettingsManager
|
||||||
|
|
||||||
|
|
@ -27,6 +28,10 @@ private fun schemeFor(accent: Color, dark: Boolean) = if (dark) {
|
||||||
primary = accent,
|
primary = accent,
|
||||||
onPrimary = if (accent.luminance() > 0.4) Ink else Color.White,
|
onPrimary = if (accent.luminance() > 0.4) Ink else Color.White,
|
||||||
secondary = accent.copy(alpha = 0.8f),
|
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,
|
background = DeepNavy,
|
||||||
surface = NavySurface,
|
surface = NavySurface,
|
||||||
onBackground = Color(0xFFE6EDF3),
|
onBackground = Color(0xFFE6EDF3),
|
||||||
|
|
@ -37,6 +42,8 @@ private fun schemeFor(accent: Color, dark: Boolean) = if (dark) {
|
||||||
primary = accent,
|
primary = accent,
|
||||||
onPrimary = if (accent.luminance() > 0.4) Ink else Color.White,
|
onPrimary = if (accent.luminance() > 0.4) Ink else Color.White,
|
||||||
secondary = accent.copy(alpha = 0.8f),
|
secondary = accent.copy(alpha = 0.8f),
|
||||||
|
primaryContainer = lerp(Color.White, accent, 0.35f),
|
||||||
|
onPrimaryContainer = if (accent.luminance() > 0.4) Ink else Color.White,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue