ui: bring back the card mimetype accent

Two agents independently dropped it, each because our Card had no `color` prop
and each citing the other's precedent -- which is how a deliberate feature
quietly becomes a convention.  Roland wanted it back.

Card takes a token colour name and draws it as a 3px edge along the top rather
than tinting the surface: surfaces stay flat per the design rules, and an edge
survives night mode without becoming a bright patch.  Because it is a token, the
accent remaps per theme -- four hues in light and dark, a single one in night and
amber, which is the point of those themes.

Restored on every card that shows a file: the video, image and generic file cards
in Files.js, and the archive card.  All of them take it from
`mimetypeColor(mimetype, path)`, the same helper that colours the file icons, so
a card and its icon agree.
This commit is contained in:
Roland 2026-07-30 13:51:05 -06:00
parent 96d84dfab8
commit a1fbda7363
No known key found for this signature in database
GPG key ID: 1BA620CE6C9A4680
5 changed files with 51 additions and 11 deletions

View file

@ -17,7 +17,8 @@ import {
TagIcon,
Toggle,
textEllipsis,
useTitle
mimetypeColor,
useTitle,
} from "./Common";
import {
usePages,
@ -116,6 +117,7 @@ function EbookCard({file, sortField}) {
return <Card media={<CardPoster file={file} to={detailUrl}/>}
title={<Tooltip label={title}>{header}</Tooltip>}
meta={meta}
color={mimetypeColor(file.mimetype, file.primary_path)}
/>
}
@ -134,6 +136,7 @@ function ImageCard({file}) {
return <Card media={<PreviewLink file={file}><CardPoster file={file}/></PreviewLink>}
title={<Tooltip label={title}>{header}</Tooltip>}
meta={meta}
color={mimetypeColor(file.mimetype, file.primary_path)}
/>
}
@ -175,7 +178,8 @@ function FileCard({file}) {
</>
}
</>;
return <Card media={<CardPoster file={file}/>} title={header} meta={meta}/>
return <Card media={<CardPoster file={file}/>} title={header} meta={meta}
color={mimetypeColor(file.mimetype, file.primary_path)}/>
}
export function FileCards({files}) {