import { average } from 'color.js' import { colord } from 'colord' import SvgIcon from '@/components/SvgIcon' enum ACTION { DISLIKE = 'dislike', PLAY = 'play', NEXT = 'next', } const FMCard = () => { const coverUrl = 'https://p1.music.126.net/lEzPSOjusKaRXKXT3987lQ==/109951166035876388.jpg?param=512y512' const [background, setBackground] = useState('') useEffect(() => { average(coverUrl, { amount: 1, format: 'hex', sample: 1 }).then(color => { const to = colord(color as string) .darken(0.15) .rotate(-5) .toHex() setBackground(`linear-gradient(to bottom right, ${color}, ${to})`) }) }, [coverUrl]) return (