toot medias: extract color from blurhash
All checks were successful
/ depoly (push) Successful in 1m17s
All checks were successful
/ depoly (push) Successful in 1m17s
This commit is contained in:
parent
c372ea4a92
commit
2aa2cf21da
5 changed files with 226 additions and 40 deletions
|
@ -20,6 +20,7 @@ import {
|
|||
} from "@solid-primitives/resize-observer";
|
||||
import { useStore } from "@nanostores/solid";
|
||||
import { $settings } from "../settings/stores";
|
||||
import { averageColorHex } from "../platform/blurhash";
|
||||
|
||||
type ElementSize = { width: number; height: number };
|
||||
|
||||
|
@ -120,7 +121,9 @@ const MediaAttachmentGrid: Component<{
|
|||
// we may need better tool to manage the performance impact
|
||||
// before using this. See #37.
|
||||
// TODO: use fast average color to extract accent color
|
||||
const accentColor = item.meta?.colors?.accent;
|
||||
const accentColor =
|
||||
item.meta?.colors?.accent ??
|
||||
(item.blurhash ? averageColorHex(item.blurhash) : undefined);
|
||||
|
||||
return Object.assign(
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue