Roles we hadn't set fell back to Material's purple baseline, giving dark purple text on pale-blue buttons, near-invisible field borders and a now-playing panel that blended into the background. Both themes now define every role from the web UI palette, checked at >= 4.5:1 for text and >= 3:1 for field borders. The amber panel is theme-aware with an edge, and the "waiting to send" line no longer uses amber on the light page background. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e7e19c2f8d
commit
0be4ff9dce
5 files changed
+85
-45
No files matched your search
@@ -6,7 +6,6 @@ import androidx.compose.foundation.layout.padding
|
|||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.material3.NavigationBar
|
import androidx.compose.material3.NavigationBar
|
||||||
import androidx.compose.material3.NavigationBarItem
|
import androidx.compose.material3.NavigationBarItem
|
||||||
import androidx.compose.material3.NavigationBarItemDefaults
|
|
||||||
import androidx.compose.material3.Scaffold
|
import androidx.compose.material3.Scaffold
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
@@ -47,13 +46,12 @@ fun ScrobbledApp(services: AppServices, serverUrl: String, username: String, onS
|
|||||||
val current by nav.currentBackStackEntryAsState()
|
val current by nav.currentBackStackEntryAsState()
|
||||||
Scaffold(
|
Scaffold(
|
||||||
bottomBar = {
|
bottomBar = {
|
||||||
NavigationBar(containerColor = MaterialTheme.colorScheme.surfaceVariant) {
|
NavigationBar(containerColor = MaterialTheme.colorScheme.surfaceContainer) {
|
||||||
Destination.entries.forEach { d ->
|
Destination.entries.forEach { d ->
|
||||||
NavigationBarItem(
|
NavigationBarItem(
|
||||||
selected = current?.destination?.route == d.route,
|
selected = current?.destination?.route == d.route,
|
||||||
onClick = { nav.navigate(d.route) { launchSingleTop = true } },
|
onClick = { nav.navigate(d.route) { launchSingleTop = true } },
|
||||||
icon = {},
|
icon = {},
|
||||||
colors = NavigationBarItemDefaults.colors(indicatorColor = MaterialTheme.colorScheme.outline),
|
|
||||||
label = { Text(d.label) },
|
label = { Text(d.label) },
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ import androidx.compose.material3.Button
|
|||||||
import androidx.compose.material3.CircularProgressIndicator
|
import androidx.compose.material3.CircularProgressIndicator
|
||||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||||
import androidx.compose.material3.FilterChip
|
import androidx.compose.material3.FilterChip
|
||||||
import androidx.compose.material3.FilterChipDefaults
|
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.material3.OutlinedTextField
|
import androidx.compose.material3.OutlinedTextField
|
||||||
import androidx.compose.material3.PrimaryTabRow
|
import androidx.compose.material3.PrimaryTabRow
|
||||||
@@ -112,8 +111,7 @@ private fun ManualTab(s: AddState, vm: AddViewModel) {
|
|||||||
Row(Modifier.horizontalScroll(rememberScrollState()), horizontalArrangement = Arrangement.spacedBy(8.dp)) {
|
Row(Modifier.horizontalScroll(rememberScrollState()), horizontalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||||
WhenOption.entries.forEach { o ->
|
WhenOption.entries.forEach { o ->
|
||||||
FilterChip(
|
FilterChip(
|
||||||
selected = s.whenOption == o, onClick = { vm.onWhen(o) }, label = { Text(o.label) },
|
selected = s.whenOption == o, onClick = { vm.onWhen(o) }, label = { Text(o.label) }
|
||||||
colors = FilterChipDefaults.filterChipColors(selectedContainerColor = MaterialTheme.colorScheme.outline),
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package dev.daubney.scrobbled.ui.home
|
package dev.daubney.scrobbled.ui.home
|
||||||
|
|
||||||
import androidx.compose.foundation.background
|
import androidx.compose.foundation.background
|
||||||
|
import androidx.compose.foundation.border
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.foundation.layout.Row
|
import androidx.compose.foundation.layout.Row
|
||||||
@@ -26,9 +27,7 @@ import androidx.lifecycle.repeatOnLifecycle
|
|||||||
import dev.daubney.scrobbled.data.history.NowPlaying
|
import dev.daubney.scrobbled.data.history.NowPlaying
|
||||||
import dev.daubney.scrobbled.data.history.Summary
|
import dev.daubney.scrobbled.data.history.Summary
|
||||||
import dev.daubney.scrobbled.ui.ScrobbleRow
|
import dev.daubney.scrobbled.ui.ScrobbleRow
|
||||||
import dev.daubney.scrobbled.ui.theme.Glow
|
import dev.daubney.scrobbled.ui.theme.AppColors
|
||||||
import dev.daubney.scrobbled.ui.theme.Panel
|
|
||||||
import dev.daubney.scrobbled.ui.theme.PanelText
|
|
||||||
|
|
||||||
private const val POLL_MS = 15_000L
|
private const val POLL_MS = 15_000L
|
||||||
|
|
||||||
@@ -63,7 +62,7 @@ fun HomeScreen(vm: HomeViewModel, onSettings: () -> Unit) {
|
|||||||
item {
|
item {
|
||||||
Text(
|
Text(
|
||||||
if (state.pending == 1) "1 scrobble waiting to send" else "${state.pending} scrobbles waiting to send",
|
if (state.pending == 1) "1 scrobble waiting to send" else "${state.pending} scrobbles waiting to send",
|
||||||
color = Glow, style = MaterialTheme.typography.labelLarge,
|
color = MaterialTheme.colorScheme.primary, style = MaterialTheme.typography.labelLarge,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -80,17 +79,19 @@ fun HomeScreen(vm: HomeViewModel, onSettings: () -> Unit) {
|
|||||||
/** The dark "hi-fi front panel" from the web UI, glowing amber while something plays. */
|
/** The dark "hi-fi front panel" from the web UI, glowing amber while something plays. */
|
||||||
@Composable
|
@Composable
|
||||||
private fun NowPlayingPanel(np: NowPlaying?) {
|
private fun NowPlayingPanel(np: NowPlaying?) {
|
||||||
|
val panel = AppColors.panel
|
||||||
Column(
|
Column(
|
||||||
Modifier.fillMaxWidth().background(Panel, RoundedCornerShape(14.dp)).padding(20.dp),
|
Modifier.fillMaxWidth().background(panel.background, RoundedCornerShape(14.dp))
|
||||||
|
.border(1.dp, panel.edge, RoundedCornerShape(14.dp)).padding(20.dp),
|
||||||
verticalArrangement = Arrangement.spacedBy(4.dp),
|
verticalArrangement = Arrangement.spacedBy(4.dp),
|
||||||
) {
|
) {
|
||||||
Text(if (np != null) "NOW PLAYING" else "NOTHING PLAYING", style = MaterialTheme.typography.labelMedium, color = PanelText)
|
Text(if (np != null) "NOW PLAYING" else "NOTHING PLAYING", style = MaterialTheme.typography.labelMedium, color = panel.text)
|
||||||
if (np != null) {
|
if (np != null) {
|
||||||
Text(np.track, style = MaterialTheme.typography.titleLarge, color = Glow)
|
Text(np.track, style = MaterialTheme.typography.titleLarge, color = panel.glow)
|
||||||
Text(np.artist, style = MaterialTheme.typography.bodyLarge, color = Glow)
|
Text(np.artist, style = MaterialTheme.typography.bodyLarge, color = panel.glow)
|
||||||
np.album?.let { Text(it, style = MaterialTheme.typography.bodyMedium, color = PanelText) }
|
np.album?.let { Text(it, style = MaterialTheme.typography.bodyMedium, color = panel.text) }
|
||||||
} else {
|
} else {
|
||||||
Text("—", style = MaterialTheme.typography.titleLarge, color = PanelText)
|
Text("—", style = MaterialTheme.typography.titleLarge, color = panel.text)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import android.content.pm.PackageManager
|
|||||||
import androidx.activity.compose.rememberLauncherForActivityResult
|
import androidx.activity.compose.rememberLauncherForActivityResult
|
||||||
import androidx.activity.result.contract.ActivityResultContracts
|
import androidx.activity.result.contract.ActivityResultContracts
|
||||||
import androidx.compose.foundation.background
|
import androidx.compose.foundation.background
|
||||||
|
import androidx.compose.foundation.border
|
||||||
import androidx.compose.foundation.clickable
|
import androidx.compose.foundation.clickable
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
@@ -37,8 +38,7 @@ import androidx.compose.ui.text.style.TextAlign
|
|||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.core.content.ContextCompat
|
import androidx.core.content.ContextCompat
|
||||||
import dev.daubney.scrobbled.ui.TrackFields
|
import dev.daubney.scrobbled.ui.TrackFields
|
||||||
import dev.daubney.scrobbled.ui.theme.Glow
|
import dev.daubney.scrobbled.ui.theme.AppColors
|
||||||
import dev.daubney.scrobbled.ui.theme.Panel
|
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun ListenScreen(vm: ListenViewModel, demoMode: Boolean) {
|
fun ListenScreen(vm: ListenViewModel, demoMode: Boolean) {
|
||||||
@@ -59,10 +59,12 @@ fun ListenScreen(vm: ListenViewModel, demoMode: Boolean) {
|
|||||||
) {
|
) {
|
||||||
Text("Listen", style = MaterialTheme.typography.headlineSmall)
|
Text("Listen", style = MaterialTheme.typography.headlineSmall)
|
||||||
if (demoMode) {
|
if (demoMode) {
|
||||||
|
val panel = AppColors.panel
|
||||||
Text(
|
Text(
|
||||||
"Demo mode: results are made up. Add your ACRCloud keys in Settings to identify real music.",
|
"Demo mode: results are made up. Add your ACRCloud keys in Settings to identify real music.",
|
||||||
style = MaterialTheme.typography.labelLarge, color = Glow,
|
style = MaterialTheme.typography.labelLarge, color = panel.glow,
|
||||||
modifier = Modifier.fillMaxWidth().background(Panel, RoundedCornerShape(6.dp)).padding(12.dp),
|
modifier = Modifier.fillMaxWidth().background(panel.background, RoundedCornerShape(6.dp))
|
||||||
|
.border(1.dp, panel.edge, RoundedCornerShape(6.dp)).padding(12.dp),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
when (s.phase) {
|
when (s.phase) {
|
||||||
@@ -89,12 +91,14 @@ private fun Idle(s: ListenState, onListen: () -> Unit) {
|
|||||||
/** A big round button in the web UI's amber-on-dark panel style. */
|
/** A big round button in the web UI's amber-on-dark panel style. */
|
||||||
@Composable
|
@Composable
|
||||||
private fun ListenButton(onClick: () -> Unit) {
|
private fun ListenButton(onClick: () -> Unit) {
|
||||||
|
val panel = AppColors.panel
|
||||||
Box(Modifier.fillMaxWidth().padding(vertical = 24.dp), contentAlignment = Alignment.Center) {
|
Box(Modifier.fillMaxWidth().padding(vertical = 24.dp), contentAlignment = Alignment.Center) {
|
||||||
Box(
|
Box(
|
||||||
Modifier.size(168.dp).clip(CircleShape).background(Panel).clickable(onClick = onClick),
|
Modifier.size(168.dp).clip(CircleShape).background(panel.background)
|
||||||
|
.border(1.dp, panel.edge, CircleShape).clickable(onClick = onClick),
|
||||||
contentAlignment = Alignment.Center,
|
contentAlignment = Alignment.Center,
|
||||||
) {
|
) {
|
||||||
Text("Listen", style = MaterialTheme.typography.titleLarge, color = Glow)
|
Text("Listen", style = MaterialTheme.typography.titleLarge, color = panel.glow)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,44 +1,81 @@
|
|||||||
package dev.daubney.scrobbled.ui.theme
|
package dev.daubney.scrobbled.ui.theme
|
||||||
|
|
||||||
import androidx.compose.foundation.isSystemInDarkTheme
|
import androidx.compose.foundation.isSystemInDarkTheme
|
||||||
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.material3.Shapes
|
import androidx.compose.material3.Shapes
|
||||||
import androidx.compose.material3.darkColorScheme
|
import androidx.compose.material3.darkColorScheme
|
||||||
import androidx.compose.material3.lightColorScheme
|
import androidx.compose.material3.lightColorScheme
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.runtime.CompositionLocalProvider
|
||||||
|
import androidx.compose.runtime.Immutable
|
||||||
|
import androidx.compose.runtime.ReadOnlyComposable
|
||||||
|
import androidx.compose.runtime.staticCompositionLocalOf
|
||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
|
|
||||||
// Mirrors the web UI's paper/ink palette (frontend/css/style.css in ScrobblingService).
|
// Palette from the web UI (frontend/css/style.css in ScrobblingService). Every Material role is set
|
||||||
val Glow = Color(0xFFF2A541)
|
// explicitly: any role left out falls back to Material's purple baseline, which clashes and (in dark
|
||||||
val Panel = Color(0xFF1C2330)
|
// mode) gave low-contrast text. Text pairs are >= 4.5:1 and field borders >= 3:1 in both themes.
|
||||||
val PanelText = Color(0xFFB9C3D2)
|
|
||||||
|
|
||||||
private val Light = lightColorScheme(
|
private val Light = lightColorScheme(
|
||||||
primary = Color(0xFF2F5DA8),
|
primary = Color(0xFF2F5DA8), onPrimary = Color(0xFFFFFFFF),
|
||||||
background = Color(0xFFE8ECF1),
|
primaryContainer = Color(0xFFD3E0F7), onPrimaryContainer = Color(0xFF0E2A57),
|
||||||
surface = Color(0xFFE8ECF1),
|
secondary = Color(0xFF5B6B82), onSecondary = Color(0xFFFFFFFF),
|
||||||
surfaceVariant = Color(0xFFF4F6F9),
|
secondaryContainer = Color(0xFFCDD6E2), onSecondaryContainer = Color(0xFF18202C),
|
||||||
onBackground = Color(0xFF18202C),
|
tertiary = Color(0xFF5B6B82), onTertiary = Color(0xFFFFFFFF),
|
||||||
onSurface = Color(0xFF18202C),
|
tertiaryContainer = Color(0xFFCDD6E2), onTertiaryContainer = Color(0xFF18202C),
|
||||||
onSurfaceVariant = Color(0xFF4A5566),
|
background = Color(0xFFE8ECF1), onBackground = Color(0xFF18202C),
|
||||||
outline = Color(0xFFC9D0DA),
|
surface = Color(0xFFE8ECF1), onSurface = Color(0xFF18202C),
|
||||||
error = Color(0xFFB3412E),
|
surfaceVariant = Color(0xFFDCE2EA), onSurfaceVariant = Color(0xFF434F60),
|
||||||
|
surfaceTint = Color(0xFF2F5DA8),
|
||||||
|
surfaceDim = Color(0xFFDDE2E9), surfaceBright = Color(0xFFF4F6F9),
|
||||||
|
surfaceContainerLowest = Color(0xFFFFFFFF), surfaceContainerLow = Color(0xFFEFF2F6),
|
||||||
|
surfaceContainer = Color(0xFFF4F6F9), surfaceContainerHigh = Color(0xFFFAFBFC),
|
||||||
|
surfaceContainerHighest = Color(0xFFFFFFFF),
|
||||||
|
outline = Color(0xFF6B7789), outlineVariant = Color(0xFFC9D0DA),
|
||||||
|
error = Color(0xFFB3412E), onError = Color(0xFFFFFFFF),
|
||||||
|
errorContainer = Color(0xFFF6D5CD), onErrorContainer = Color(0xFF4A1409),
|
||||||
|
inverseSurface = Color(0xFF18202C), inverseOnSurface = Color(0xFFE8ECF1), inversePrimary = Color(0xFF8FB4F0),
|
||||||
|
scrim = Color(0xFF000000),
|
||||||
)
|
)
|
||||||
|
|
||||||
private val Dark = darkColorScheme(
|
private val Dark = darkColorScheme(
|
||||||
primary = Color(0xFF8FB4F0),
|
primary = Color(0xFF8FB4F0), onPrimary = Color(0xFF0A1D3D),
|
||||||
background = Color(0xFF12171F),
|
primaryContainer = Color(0xFF26416D), onPrimaryContainer = Color(0xFFD9E5FB),
|
||||||
surface = Color(0xFF12171F),
|
secondary = Color(0xFF8795AA), onSecondary = Color(0xFF0F1622),
|
||||||
surfaceVariant = Color(0xFF19202B),
|
secondaryContainer = Color(0xFF2D3A50), onSecondaryContainer = Color(0xFFE3E8EF),
|
||||||
onBackground = Color(0xFFE3E8EF),
|
tertiary = Color(0xFF8795AA), onTertiary = Color(0xFF0F1622),
|
||||||
onSurface = Color(0xFFE3E8EF),
|
tertiaryContainer = Color(0xFF2D3A50), onTertiaryContainer = Color(0xFFE3E8EF),
|
||||||
onSurfaceVariant = Color(0xFFA7B1C0),
|
background = Color(0xFF12171F), onBackground = Color(0xFFE3E8EF),
|
||||||
outline = Color(0xFF2C3543),
|
surface = Color(0xFF12171F), onSurface = Color(0xFFE3E8EF),
|
||||||
error = Color(0xFFE0806C),
|
surfaceVariant = Color(0xFF273142), onSurfaceVariant = Color(0xFFB3BDCC),
|
||||||
|
surfaceTint = Color(0xFF8FB4F0),
|
||||||
|
surfaceDim = Color(0xFF0E131A), surfaceBright = Color(0xFF2A3342),
|
||||||
|
surfaceContainerLowest = Color(0xFF0C1016), surfaceContainerLow = Color(0xFF151B25),
|
||||||
|
surfaceContainer = Color(0xFF19202B), surfaceContainerHigh = Color(0xFF222B38),
|
||||||
|
surfaceContainerHighest = Color(0xFF2A3442),
|
||||||
|
outline = Color(0xFF7D8AA0), outlineVariant = Color(0xFF2C3543),
|
||||||
|
error = Color(0xFFF0907C), onError = Color(0xFF3B0D05),
|
||||||
|
errorContainer = Color(0xFF7A2A1B), onErrorContainer = Color(0xFFFFDAD2),
|
||||||
|
inverseSurface = Color(0xFFE3E8EF), inverseOnSurface = Color(0xFF18202C), inversePrimary = Color(0xFF2F5DA8),
|
||||||
|
scrim = Color(0xFF000000),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
/** The web UI's "hi-fi front panel": a dark card with amber text, used for now-playing and Listen. */
|
||||||
|
@Immutable
|
||||||
|
class PanelColors(val background: Color, val edge: Color, val text: Color, val glow: Color)
|
||||||
|
|
||||||
|
private val LightPanel = PanelColors(Color(0xFF1C2330), Color(0xFF2A3445), Color(0xFFB9C3D2), Color(0xFFF2A541))
|
||||||
|
private val DarkPanel = PanelColors(Color(0xFF232D3E), Color(0xFF3A4860), Color(0xFFC5CEDB), Color(0xFFF2A541))
|
||||||
|
|
||||||
|
private val LocalPanelColors = staticCompositionLocalOf { LightPanel }
|
||||||
|
|
||||||
|
object AppColors {
|
||||||
|
val panel: PanelColors
|
||||||
|
@Composable @ReadOnlyComposable get() = LocalPanelColors.current
|
||||||
|
}
|
||||||
|
|
||||||
private val AppShapes = Shapes(
|
private val AppShapes = Shapes(
|
||||||
small = RoundedCornerShape(6.dp),
|
small = RoundedCornerShape(6.dp),
|
||||||
medium = RoundedCornerShape(6.dp),
|
medium = RoundedCornerShape(6.dp),
|
||||||
@@ -47,5 +84,7 @@ private val AppShapes = Shapes(
|
|||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun ScrobbledTheme(dark: Boolean = isSystemInDarkTheme(), content: @Composable () -> Unit) {
|
fun ScrobbledTheme(dark: Boolean = isSystemInDarkTheme(), content: @Composable () -> Unit) {
|
||||||
|
CompositionLocalProvider(LocalPanelColors provides if (dark) DarkPanel else LightPanel) {
|
||||||
MaterialTheme(colorScheme = if (dark) Dark else Light, shapes = AppShapes, content = content)
|
MaterialTheme(colorScheme = if (dark) Dark else Light, shapes = AppShapes, content = content)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user