Add dynamic color theming from poster art using node-vibrant

Extract dominant colors from movie/TV poster images server-side and use
them to create per-title atmospheric effects on detail pages — tinted
backdrop gradients, ambient glow orbs, and colored poster shadows.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-02 12:29:13 -05:00
co-authored by Claude Opus 4.6
parent 67356e04c6
commit cb0f366d44
9 changed files with 2481 additions and 6 deletions
+7
View File
@@ -2,6 +2,7 @@ import { eq } from "drizzle-orm";
import { type NextRequest, NextResponse } from "next/server";
import { db } from "@/lib/db/client";
import { availabilityOffers, episodes, seasons, titles } from "@/lib/db/schema";
import { extractAndStoreColors, parseColorPalette } from "@/lib/services/colors";
import { refreshTvChildren } from "@/lib/services/metadata";
import { getTvDetails } from "@/lib/tmdb/client";
@@ -84,8 +85,14 @@ export async function GET(
.where(eq(availabilityOffers.titleId, title.id))
.all();
// Lazy color extraction: if no palette yet, fire-and-forget for next load
if (!title.colorPalette && title.posterPath) {
extractAndStoreColors(title.id, title.posterPath).catch(() => {});
}
return NextResponse.json({
...title,
colorPalette: parseColorPalette(title.colorPalette),
seasons: titleSeasons,
availability,
});