mirror of
https://github.com/GiriNeko/YesPlayMusic.git
synced 2025-12-17 13:48:02 +00:00
fix: bugs
This commit is contained in:
parent
bc696ca59f
commit
b1fd51233a
5 changed files with 22 additions and 17 deletions
16
src/renderer/hooks/useCoverColor.ts
Normal file
16
src/renderer/hooks/useCoverColor.ts
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
import { colord } from 'colord'
|
||||
import { getCoverColor } from '../utils/common'
|
||||
|
||||
export default function useCoverColor(url: string) {
|
||||
const [color, setColor] = useState({ from: '#fff', to: '#fff' })
|
||||
|
||||
useEffect(() => {
|
||||
getCoverColor(url || '').then(color => {
|
||||
if (!color) return
|
||||
const to = colord(color).darken(0.15).rotate(-5).toHex()
|
||||
setColor({ from: color, to })
|
||||
})
|
||||
}, [url])
|
||||
|
||||
return color
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue