ant-design / ant-design

An enterprise-class UI design language and React UI library
https://ant.design
MIT License
90.42k stars 46.41k forks source link

refactor(color): @ctrl/tinycolor to color2k #48671

Open guoyunhe opened 2 weeks ago

guoyunhe commented 2 weeks ago

🤔 This is a ...

🔗 Related issue link

💡 Background and solution

@ctrl/tinycolor 的大小为 6.4KB,而 color2k 为 2.9KB,理论上可以让总体积减少 3.5KB

📝 Changelog

Language Changelog
🇺🇸 English refactor(color): replace @ctrl/tinycolor with color2k to reduce bundle size by 3.5KB (minified + gzipped)
🇨🇳 Chinese refactor(color): 将 @ctrl/tinycolor 替换为 color2k 以减少 3.5KB 打包体积 (minified + gzipped)

☑️ Self-Check before Merge

⚠️ Please check all items below before requesting a reviewing. ⚠️

stackblitz[bot] commented 2 weeks ago

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

github-actions[bot] commented 2 weeks ago

Prepare preview

github-actions[bot] commented 2 weeks ago

👁 Visual-Regression Diff Building... ⏳

This PR is under visual-regression-diff building, please wait for the result.

yoyo837 commented 2 weeks ago

还有上游包使用的 @ctrl/tinycolor 。

yoyo837 commented 2 weeks ago

不能单纯直接改,而且不能master修改。

Wxh16144 commented 2 weeks ago

感觉不错,但是 color2k 的文档说只能将颜色输出 rgba 和 hsla 🤔,并且 antd 暴露出去的方法支持更多的 format 。会不会 break change 呢

两者下载趋势:https://npmtrends.com/@ctrl/tinycolor-vs-color2k

对我来说可以试试能不能把我的 dumi-plugin-color-chunk 重构一下。

Wxh16144 commented 2 weeks ago

还有上游包使用的 @ctrl/tinycolor 。

ref: https://github.com/react-component/color-picker/blob/b1fa571f7ddaf9d6b6112e42dac6986abf40f13a/src/color.ts#L1

afc163 commented 2 weeks ago

好多冲突