feat: Now Playing's cover grows to fill the screen, and the page takes the cover's dominant colour as Android does (#5592)
release / govulncheck (push) Successful in 15s
release / web (push) Successful in 1m45s
release / go (push) Successful in 2m9s
release / integration (push) Successful in 5m44s
release / android (push) Successful in 5m49s
release / Build signed APK (releases and dev) (push) Successful in 6m9s
release / Attach APK to the Release (tag releases only) (push) Skipped
release / Build + push container image (push) Successful in 25s
release / Verify release artifacts (tag releases only) (push) Skipped
release / govulncheck (push) Successful in 15s
release / web (push) Successful in 1m45s
release / go (push) Successful in 2m9s
release / integration (push) Successful in 5m44s
release / android (push) Successful in 5m49s
release / Build signed APK (releases and dev) (push) Successful in 6m9s
release / Attach APK to the Release (tag releases only) (push) Skipped
release / Build + push container image (push) Successful in 25s
release / Verify release artifacts (tag releases only) (push) Skipped
The web colour helper now picks Palette's dominant swatch (5-bit quantise, Palette's default filter, median cut to 16, the most-populated box) instead of the 1x1 mean, so the web and Android agree; PlayerBar's accent strip shares it. Now Playing draws Android's gradient (55% at the top, 18% at 45%, then the page) as a masked background colour that fades over 600ms between tracks, holding the old colour until the new resolves. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
} from '#lib/player/store.svelte.js';
|
||||
import { formatDuration } from '#lib/media/duration.js';
|
||||
import { FALLBACK_COVER, coverUrl } from '#lib/media/covers.js';
|
||||
import { dominantColorFromUrl, rgbToCssString } from '#lib/media/dominantColor.js';
|
||||
import { useSmoothPosition } from '#lib/player/smoothPosition.svelte.js';
|
||||
import LikeButton from '#lib/components/LikeButton.svelte';
|
||||
import TrackMenu from '#lib/components/TrackMenu.svelte';
|
||||
@@ -41,6 +42,22 @@
|
||||
player.volume < 0.5 ? Volume1 : Volume2
|
||||
);
|
||||
|
||||
// The backdrop takes the cover's dominant colour, as Android's Now
|
||||
// Playing does (#5592). The colour is held until the next cover's
|
||||
// resolves, so a track change fades old to new rather than dipping to
|
||||
// the plain background between them; a track with no cover clears it.
|
||||
let tint = $state('transparent');
|
||||
$effect(() => {
|
||||
const albumId = current?.album_id;
|
||||
if (!albumId) {
|
||||
tint = 'transparent';
|
||||
return;
|
||||
}
|
||||
dominantColorFromUrl(coverUrl(albumId)).then((rgb) => {
|
||||
if (rgb && current?.album_id === albumId) tint = rgbToCssString(rgb);
|
||||
});
|
||||
});
|
||||
|
||||
function onSeekInput(e: Event) {
|
||||
const v = Number((e.currentTarget as HTMLInputElement).value);
|
||||
seekTo(v);
|
||||
@@ -66,7 +83,17 @@
|
||||
|
||||
<svelte:head><title>{pageTitle(current ? `${current.title} · ${current.artist_name}` : 'Now playing')}</title></svelte:head>
|
||||
|
||||
<div class="flex h-screen flex-col bg-background text-text-primary">
|
||||
<div class="relative isolate flex h-screen flex-col bg-background text-text-primary">
|
||||
<!-- Android's gradient (NowPlayingScreen.dominantGradient): the cover's
|
||||
colour at 55% at the top, 18% at 45% down, then the page. Drawn as a
|
||||
background colour under a mask so the colour itself can fade between
|
||||
tracks over 600ms, as Android's tween does. -->
|
||||
<div
|
||||
aria-hidden="true"
|
||||
data-testid="now-playing-tint"
|
||||
class="pointer-events-none absolute inset-0 -z-10 transition-colors duration-[600ms] motion-reduce:transition-none"
|
||||
style="background-color: {tint}; mask-image: linear-gradient(to bottom, rgb(0 0 0 / 0.55) 0%, rgb(0 0 0 / 0.18) 45%, transparent 100%);"
|
||||
></div>
|
||||
<header class="flex items-center px-4 py-3">
|
||||
<button
|
||||
type="button"
|
||||
@@ -106,8 +133,17 @@
|
||||
the bottom row). Wide-screen viewers get queue context without
|
||||
opening a drawer; mobile keeps the focused single-column flow. -->
|
||||
<main class="flex flex-1 overflow-hidden">
|
||||
<section class="flex flex-1 flex-col items-center justify-center gap-6 px-4 pb-6 overflow-y-auto">
|
||||
<div class="aspect-square w-full max-w-md overflow-hidden rounded-lg bg-surface-hover shadow-lg">
|
||||
<section class="flex flex-1 flex-col items-center justify-center px-4 pb-6 overflow-y-auto">
|
||||
<!-- The column is as wide as the cover, and the cover as big as the
|
||||
screen allows: the window's height less what the title and
|
||||
controls beneath it need (26rem), never under 16rem, never over
|
||||
52rem, never wider than the pane (#5592). -->
|
||||
<div
|
||||
class="flex flex-col items-center gap-6"
|
||||
style="width: min(100%, max(16rem, calc(100dvh - 26rem)), 52rem);"
|
||||
data-testid="now-playing-column"
|
||||
>
|
||||
<div class="aspect-square w-full overflow-hidden rounded-lg bg-surface-hover shadow-lg">
|
||||
<img
|
||||
src={coverUrl(current.album_id)}
|
||||
alt=""
|
||||
@@ -116,11 +152,11 @@
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="w-full max-w-md text-center">
|
||||
<h1 class="font-display text-2xl font-medium leading-tight">
|
||||
<div class="w-full text-center">
|
||||
<h1 class="font-display text-2xl font-medium leading-tight lg:text-3xl">
|
||||
{current.title}
|
||||
</h1>
|
||||
<p class="mt-1 text-sm">
|
||||
<p class="mt-1 text-sm lg:text-base">
|
||||
<a
|
||||
href={`/artists/${current.artist_id}`}
|
||||
class="text-text-secondary hover:text-text-primary hover:underline"
|
||||
@@ -139,7 +175,7 @@
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="w-full max-w-md">
|
||||
<div class="w-full">
|
||||
<input
|
||||
type="range"
|
||||
min="0"
|
||||
@@ -227,7 +263,7 @@
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="flex w-full max-w-md items-center justify-between gap-4">
|
||||
<div class="flex w-full items-center justify-between gap-4">
|
||||
<div class="flex items-center gap-2">
|
||||
<LikeButton entityType="track" entityId={current.id} />
|
||||
</div>
|
||||
@@ -259,6 +295,7 @@
|
||||
<span class="text-sm tabular-nums">{player.queue.length}</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<aside
|
||||
aria-label="Queue"
|
||||
|
||||
Reference in New Issue
Block a user