himself65 / npm-download-stat

https://npm-stat.link
MIT License
67 stars 6 forks source link

pick color dynamically #23

Open cloudflypeng opened 10 months ago

cloudflypeng commented 10 months ago

我看现在统一定义了一个textAccentMap用来获取颜色, 通过图标动态取主题色可以看看 这个库 我不太了解服务端渲染,你应该可以参考一下

textAccentMap is const variable to pick color, it would be better to pick color using some library

v1siuol commented 10 months ago

I like this idea, but looks like color-thief is a cjs lib, and I am not sure if there is an easy way to import it as an ES6 module in Node env note. We can probably find some other alternatives. (I am a beginner, so please correct me if I am wrong X

cloudflypeng commented 10 months ago

I like this idea, but looks like color-thief is a cjs lib, and I am not sure if there is an easy way to import it as an ES6 module in Node env note. We can probably find some other alternatives. (I am a beginner, so please correct me if I am wrong X

the color-thief is not work , bacause it dependent get-pixels, i think the solution with dom or fileReader is not work. now i am learning how to get color from Uint8Array

cloudflypeng commented 10 months ago
image

I got an incorrect color, but I feel like I'm getting closer. Another issue is that the color text - [# 482412] I generated was not generated by tailwind

himself65 commented 10 months ago

You might need this one? https://tailwindcss.com/docs/text-color#arbitrary-values

And also consider the dark mode