配色好难处理啊,MDC的primaryColor和secondaryColor到底是怎么调出来的?目前只能做到这个水平了
const image = new Image();
image.crossOrigin = "anonymous";
image.src = this.$props.song.thumbnail;
image.addEventListener("load", async (event) => {
const colorThief = new ColorThief();
let color = await colorThief.getColor(image);
const contrast = chroma.contrast(chroma(...color).hex(), "#ffffff");
if (contrast < 4) return;
this.primaryColor = chroma(...color).hex();
this.secondaryColor = chroma(...color)
.brighten()
.hex();
this.darkColor = chroma(...color)
.darken()
.hex();
this.lightColor = chroma(...color)
.brighten(2.5)
.hex();
});
每个人都有属于自己的一片森林,也许我们从来不曾走过,但它一直在那里,总会在那里。迷失的人迷失了,相逢的人会再相逢。愿这里,成为属于你的小森林。