import type { HomepageSummarySite } from "yt-dlp-transcript-common/lib/homepageSummary"; import { siteAccentColor, siteChartColors, siteColor, } from "yt-dlp-transcript-common/lib/siteColor"; import { Wordmark } from "yt-dlp-transcript-common/components/Wordmark"; // The official instances: one card per public archive, its title linking out, // its own numbers underneath. No description line under the title — the // page's copy rule is no subtitles unless needed, and the name plus the // numbers say what the archive is. // // THE STRIPE IS THE SITE'S OWN ACCENT (release 10, the operator's ask): // siteColor() — a named accent as `var(--swatch-)`, its value on the base // in force, from the summary's `accentId`; a custom hex fitted to each base as // the site's own pages fit it (release 11: a pale hex published as is was // ~1.4:1 on light); a site with no accent its chart colour. The // hub's official cards wear the same (lib/hubSummary.ts officialInstances). // // A CARD STILL READS AS ITS LAYER'S LEGEND, BY HUE. The growth chart draws // each site in the validated chart slot of its accent's hue family // (siteChartColors: Brass → amber, Blue → blue, Violet → violet, Green → // green, Sakura → magenta, Vermilion → rust), not in the accent itself — the // accents fail as a chart palette (Brass↔Vermilion ΔE 1.0 deutan, Blue↔Violet // 8.5 normal). So a family accent's stripe and its layer are one hue at two // values, and a site with no accent matches its layer exactly. Signal and a // custom hex have no family, so their layer is a palette colour of its own; // ArchiveGrowthChart's legend names every layer either way. // // Numbers are v5 fields; a pre-v5 summary lacks them and the card shows only // the transcript count it always had. function Figure({ value, unit }: { value: number | undefined; unit: string }) { if (value === undefined) return null; return (
{unit}
{value.toLocaleString()}
); } // THE NAME IS THE SITE'S WORDMARK when the summary carries its lead: the lead // heavy, the rest light (common/components/Wordmark.tsx, as the site's own // header sets it), at the card title's size. The lead is TINTED in the site's // own accent (siteAccentColor: a named accent's swatch, a custom hex fitted to // the base in force — above 4:1 on the card on every base); a site with no // accent keeps the foreground. The two spans are adjacent inline text, so the // link's accessible name stays the plain title. With no lead (none configured, // or a summary from before release 14) the title is plain, as it was. In forced // colours the tint is the system's text colour, like any text. function SiteName({ site }: { site: HomepageSummarySite }) { if (!site.wordmarkLead) return <>{site.siteTitle}; const accent = siteAccentColor(site); return ( ); } export function ArchiveCards({ sites }: { sites: HomepageSummarySite[] }) { if (sites.length === 0) return null; const chart = siteChartColors(sites); return ( ); }