diff --git a/README.md b/README.md index c403a71..fe22b72 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Last.fm-compatible scrobbling server. With it you can: - **See** what you're listening to now, your totals, and your scrobble history. - **Scrobble offline**: scrobbles made without a connection are saved on the device and sent automatically later. -The app follows the system light/dark setting. +The app follows the system light/dark setting and uses the Scrobbled brand palette, wordmark and Bricolage Grotesque typeface from [ScrobbledDesign](https://git.daubney.dev/matt/ScrobbledDesign) (artwork licence and font licence in `design/`). ## Requirements diff --git a/app/src/main/java/dev/daubney/scrobbled/ui/connect/ConnectScreen.kt b/app/src/main/java/dev/daubney/scrobbled/ui/connect/ConnectScreen.kt index a200625..ba25971 100644 --- a/app/src/main/java/dev/daubney/scrobbled/ui/connect/ConnectScreen.kt +++ b/app/src/main/java/dev/daubney/scrobbled/ui/connect/ConnectScreen.kt @@ -17,6 +17,7 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.text.input.KeyboardType import androidx.compose.ui.text.input.PasswordVisualTransformation import androidx.compose.ui.unit.dp +import dev.daubney.scrobbled.ui.theme.Wordmark @Composable fun ConnectScreen(vm: ConnectViewModel) { @@ -25,7 +26,7 @@ fun ConnectScreen(vm: ConnectViewModel) { Modifier.fillMaxSize().padding(24.dp), verticalArrangement = Arrangement.spacedBy(12.dp, androidx.compose.ui.Alignment.CenterVertically), ) { - Text("Scrobbled", style = MaterialTheme.typography.headlineMedium) + Wordmark(height = 44.dp) Text("Connect to your scrobbling server", color = MaterialTheme.colorScheme.onSurfaceVariant) OutlinedTextField( s.serverUrl, vm::onServerUrl, Modifier.fillMaxWidth(), singleLine = true, diff --git a/app/src/main/java/dev/daubney/scrobbled/ui/home/HomeScreen.kt b/app/src/main/java/dev/daubney/scrobbled/ui/home/HomeScreen.kt index c00a483..cef852e 100644 --- a/app/src/main/java/dev/daubney/scrobbled/ui/home/HomeScreen.kt +++ b/app/src/main/java/dev/daubney/scrobbled/ui/home/HomeScreen.kt @@ -28,6 +28,7 @@ import dev.daubney.scrobbled.data.history.NowPlaying import dev.daubney.scrobbled.data.history.Summary import dev.daubney.scrobbled.ui.ScrobbleRow import dev.daubney.scrobbled.ui.theme.AppColors +import dev.daubney.scrobbled.ui.theme.Wordmark private const val POLL_MS = 15_000L @@ -52,7 +53,7 @@ fun HomeScreen(vm: HomeViewModel, onSettings: () -> Unit) { ) { item { Row(Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.SpaceBetween) { - Text("Scrobbled", style = MaterialTheme.typography.headlineSmall) + Wordmark(height = 28.dp) TextButton(onSettings) { Text("Settings") } } } @@ -76,7 +77,7 @@ 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 lime while something plays. */ @Composable private fun NowPlayingPanel(np: NowPlaying?) { val panel = AppColors.panel diff --git a/app/src/main/java/dev/daubney/scrobbled/ui/listen/ListenScreen.kt b/app/src/main/java/dev/daubney/scrobbled/ui/listen/ListenScreen.kt index 6eeac4a..72f4829 100644 --- a/app/src/main/java/dev/daubney/scrobbled/ui/listen/ListenScreen.kt +++ b/app/src/main/java/dev/daubney/scrobbled/ui/listen/ListenScreen.kt @@ -88,7 +88,7 @@ private fun Idle(s: ListenState, onListen: () -> Unit) { s.error?.let { Text(it, color = MaterialTheme.colorScheme.error, modifier = Modifier.fillMaxWidth(), textAlign = TextAlign.Center) } } -/** A big round button in the web UI's amber-on-dark panel style. */ +/** A big round button in the lime-on-dark panel style. */ @Composable private fun ListenButton(onClick: () -> Unit) { val panel = AppColors.panel diff --git a/app/src/main/java/dev/daubney/scrobbled/ui/theme/Theme.kt b/app/src/main/java/dev/daubney/scrobbled/ui/theme/Theme.kt index 3c7a6fa..4195930 100644 --- a/app/src/main/java/dev/daubney/scrobbled/ui/theme/Theme.kt +++ b/app/src/main/java/dev/daubney/scrobbled/ui/theme/Theme.kt @@ -14,60 +14,61 @@ import androidx.compose.runtime.staticCompositionLocalOf import androidx.compose.ui.graphics.Color import androidx.compose.ui.unit.dp -// Palette from the web UI (frontend/css/style.css in ScrobblingService). Every Material role is set -// explicitly: any role left out falls back to Material's purple baseline, which clashes and (in dark -// mode) gave low-contrast text. Text pairs are >= 4.5:1 and field borders >= 3:1 in both themes. +// Brand palette from ScrobbledDesign: Ink #15131A, Paper #F4F1EA, Violet #8B6CFF, Lime #C8F560, Night #1F1C28. +// Raw violet is too faint for text on paper, so light mode uses a deeper violet and dark mode a lighter one. +// Every Material role is set explicitly: any role left out falls back to Material's purple baseline. +// Text pairs are >= 4.5:1 and field borders >= 3:1 in both themes. private val Light = lightColorScheme( - primary = Color(0xFF2F5DA8), onPrimary = Color(0xFFFFFFFF), - primaryContainer = Color(0xFFD3E0F7), onPrimaryContainer = Color(0xFF0E2A57), - secondary = Color(0xFF5B6B82), onSecondary = Color(0xFFFFFFFF), - secondaryContainer = Color(0xFFCDD6E2), onSecondaryContainer = Color(0xFF18202C), - tertiary = Color(0xFF5B6B82), onTertiary = Color(0xFFFFFFFF), - tertiaryContainer = Color(0xFFCDD6E2), onTertiaryContainer = Color(0xFF18202C), - background = Color(0xFFE8ECF1), onBackground = Color(0xFF18202C), - surface = Color(0xFFE8ECF1), onSurface = Color(0xFF18202C), - 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), + primary = Color(0xFF6444DB), onPrimary = Color(0xFFFFFFFF), + primaryContainer = Color(0xFFDDD5FF), onPrimaryContainer = Color(0xFF2A1C73), + secondary = Color(0xFF4A4658), onSecondary = Color(0xFFFFFFFF), + secondaryContainer = Color(0xFFE1DBF5), onSecondaryContainer = Color(0xFF2A2538), + tertiary = Color(0xFF4A4658), onTertiary = Color(0xFFFFFFFF), + tertiaryContainer = Color(0xFFE1DBF5), onTertiaryContainer = Color(0xFF2A2538), + background = Color(0xFFF4F1EA), onBackground = Color(0xFF15131A), + surface = Color(0xFFF4F1EA), onSurface = Color(0xFF15131A), + surfaceVariant = Color(0xFFE6E1D6), onSurfaceVariant = Color(0xFF4A4658), + surfaceTint = Color(0xFF6444DB), + surfaceDim = Color(0xFFE2DED3), surfaceBright = Color(0xFFFAF8F3), + surfaceContainerLowest = Color(0xFFFFFFFF), surfaceContainerLow = Color(0xFFF8F6F0), + surfaceContainer = Color(0xFFFAF8F3), surfaceContainerHigh = Color(0xFFFDFCF9), surfaceContainerHighest = Color(0xFFFFFFFF), - outline = Color(0xFF6B7789), outlineVariant = Color(0xFFC9D0DA), + outline = Color(0xFF847F92), outlineVariant = Color(0xFFD6D1C6), error = Color(0xFFB3412E), onError = Color(0xFFFFFFFF), errorContainer = Color(0xFFF6D5CD), onErrorContainer = Color(0xFF4A1409), - inverseSurface = Color(0xFF18202C), inverseOnSurface = Color(0xFFE8ECF1), inversePrimary = Color(0xFF8FB4F0), + inverseSurface = Color(0xFF1F1C28), inverseOnSurface = Color(0xFFF4F1EA), inversePrimary = Color(0xFFA892FF), scrim = Color(0xFF000000), ) private val Dark = darkColorScheme( - primary = Color(0xFF8FB4F0), onPrimary = Color(0xFF0A1D3D), - primaryContainer = Color(0xFF26416D), onPrimaryContainer = Color(0xFFD9E5FB), - secondary = Color(0xFF8795AA), onSecondary = Color(0xFF0F1622), - secondaryContainer = Color(0xFF2D3A50), onSecondaryContainer = Color(0xFFE3E8EF), - tertiary = Color(0xFF8795AA), onTertiary = Color(0xFF0F1622), - tertiaryContainer = Color(0xFF2D3A50), onTertiaryContainer = Color(0xFFE3E8EF), - background = Color(0xFF12171F), onBackground = Color(0xFFE3E8EF), - surface = Color(0xFF12171F), onSurface = Color(0xFFE3E8EF), - 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), + primary = Color(0xFFA892FF), onPrimary = Color(0xFF1A0F4D), + primaryContainer = Color(0xFF43359A), onPrimaryContainer = Color(0xFFE6E0FF), + secondary = Color(0xFFC4BFD0), onSecondary = Color(0xFF1F1C28), + secondaryContainer = Color(0xFF3A3548), onSecondaryContainer = Color(0xFFF4F1EA), + tertiary = Color(0xFFC8F560), onTertiary = Color(0xFF1F2A00), + tertiaryContainer = Color(0xFF3A4A0C), onTertiaryContainer = Color(0xFFE2FFA0), + background = Color(0xFF1F1C28), onBackground = Color(0xFFF4F1EA), + surface = Color(0xFF1F1C28), onSurface = Color(0xFFF4F1EA), + surfaceVariant = Color(0xFF2E2A3B), onSurfaceVariant = Color(0xFFC4BFD0), + surfaceTint = Color(0xFFA892FF), + surfaceDim = Color(0xFF181620), surfaceBright = Color(0xFF383349), + surfaceContainerLowest = Color(0xFF15131A), surfaceContainerLow = Color(0xFF24212F), + surfaceContainer = Color(0xFF2A2636), surfaceContainerHigh = Color(0xFF353043), + surfaceContainerHighest = Color(0xFF403A50), + outline = Color(0xFF8B86A0), outlineVariant = Color(0xFF3B3649), error = Color(0xFFF0907C), onError = Color(0xFF3B0D05), errorContainer = Color(0xFF7A2A1B), onErrorContainer = Color(0xFFFFDAD2), - inverseSurface = Color(0xFFE3E8EF), inverseOnSurface = Color(0xFF18202C), inversePrimary = Color(0xFF2F5DA8), + inverseSurface = Color(0xFFF4F1EA), inverseOnSurface = Color(0xFF1F1C28), inversePrimary = Color(0xFF6444DB), scrim = Color(0xFF000000), ) -/** The web UI's "hi-fi front panel": a dark card with amber text, used for now-playing and Listen. */ +/** A dark "hi-fi front panel" card with lime 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 LightPanel = PanelColors(Color(0xFF15131A), Color(0xFF2E2A3B), Color(0xFFCFCADA), Color(0xFFC8F560)) +private val DarkPanel = PanelColors(Color(0xFF2E2A3B), Color(0xFF4A4560), Color(0xFFD6D1E0), Color(0xFFC8F560)) private val LocalPanelColors = staticCompositionLocalOf { LightPanel } @@ -85,6 +86,8 @@ private val AppShapes = Shapes( @Composable 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, typography = AppTypography, shapes = AppShapes, content = content, + ) } } diff --git a/app/src/main/java/dev/daubney/scrobbled/ui/theme/Type.kt b/app/src/main/java/dev/daubney/scrobbled/ui/theme/Type.kt new file mode 100644 index 0000000..8b7c7bc --- /dev/null +++ b/app/src/main/java/dev/daubney/scrobbled/ui/theme/Type.kt @@ -0,0 +1,29 @@ +package dev.daubney.scrobbled.ui.theme + +import androidx.compose.material3.Typography +import androidx.compose.ui.text.TextStyle +import androidx.compose.ui.text.font.Font +import androidx.compose.ui.text.font.FontFamily +import androidx.compose.ui.text.font.FontWeight +import dev.daubney.scrobbled.R + +/** Bricolage Grotesque (SIL OFL, see design/OFL.txt): the brand typeface, used for headings and labels. */ +private val Bricolage = FontFamily( + Font(R.font.bricolage_grotesque_600, FontWeight.SemiBold), + Font(R.font.bricolage_grotesque_800, FontWeight.ExtraBold), +) + +private val Base = Typography() + +private fun TextStyle.brand() = copy(fontFamily = Bricolage, fontWeight = FontWeight.SemiBold) + +/** Headings and titles use the brand face; body text stays on the system font for legibility. */ +val AppTypography = Base.copy( + headlineLarge = Base.headlineLarge.brand(), + headlineMedium = Base.headlineMedium.brand(), + headlineSmall = Base.headlineSmall.brand(), + titleLarge = Base.titleLarge.brand(), + titleMedium = Base.titleMedium.brand(), + labelLarge = Base.labelLarge.brand(), + labelMedium = Base.labelMedium.brand(), +) diff --git a/app/src/main/java/dev/daubney/scrobbled/ui/theme/Wordmark.kt b/app/src/main/java/dev/daubney/scrobbled/ui/theme/Wordmark.kt new file mode 100644 index 0000000..4023cef --- /dev/null +++ b/app/src/main/java/dev/daubney/scrobbled/ui/theme/Wordmark.kt @@ -0,0 +1,20 @@ +package dev.daubney.scrobbled.ui.theme + +import androidx.compose.foundation.Image +import androidx.compose.material3.MaterialTheme +import androidx.compose.runtime.Composable +import androidx.compose.foundation.layout.height +import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.luminance +import androidx.compose.ui.res.painterResource +import androidx.compose.ui.unit.Dp +import androidx.compose.ui.unit.dp +import dev.daubney.scrobbled.R + +/** The lowercase "scrobbled" wordmark: paper with a lime "b" on dark, ink with a violet "b" on light. */ +@Composable +fun Wordmark(modifier: Modifier = Modifier, height: Dp = 32.dp) { + val dark = MaterialTheme.colorScheme.background.luminance() < 0.5f + val res = if (dark) R.drawable.wordmark_on_dark else R.drawable.wordmark_on_light + Image(painterResource(res), contentDescription = "Scrobbled", modifier = modifier.height(height)) +} diff --git a/app/src/main/res/drawable/wordmark_on_dark.xml b/app/src/main/res/drawable/wordmark_on_dark.xml new file mode 100644 index 0000000..cede92a --- /dev/null +++ b/app/src/main/res/drawable/wordmark_on_dark.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/wordmark_on_light.xml b/app/src/main/res/drawable/wordmark_on_light.xml new file mode 100644 index 0000000..b68ad07 --- /dev/null +++ b/app/src/main/res/drawable/wordmark_on_light.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + diff --git a/app/src/main/res/font/bricolage_grotesque_600.ttf b/app/src/main/res/font/bricolage_grotesque_600.ttf new file mode 100644 index 0000000..a3f2376 Binary files /dev/null and b/app/src/main/res/font/bricolage_grotesque_600.ttf differ diff --git a/app/src/main/res/font/bricolage_grotesque_800.ttf b/app/src/main/res/font/bricolage_grotesque_800.ttf new file mode 100644 index 0000000..24493b1 Binary files /dev/null and b/app/src/main/res/font/bricolage_grotesque_800.ttf differ diff --git a/design/OFL.txt b/design/OFL.txt new file mode 100644 index 0000000..49135ef --- /dev/null +++ b/design/OFL.txt @@ -0,0 +1,93 @@ +Copyright 2022 The Bricolage Grotesque Project Authors (https://github.com/ateliertriay/bricolage) + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE.