weapp-tailwindcss icon indicating copy to clipboard operation
weapp-tailwindcss copied to clipboard

[Bug]: 颜色带透明度会生成 color-mix

Open chioio opened this issue 7 months ago • 2 comments

weapp-tailwindcss 版本

4.1.x

tailwindcss 版本

4.1.x

框架 & 小程序平台

taro react 编译到 微信小程序

最小复现bug的代码仓库链接

none

复现bug的步骤

  • Code first:
<View className='size-12 bg-blue-500/30'>BLUE BLOCK</View>

最终结果会生成:

background-color: color-mix(in oklab, var(--color-blue-500) 30%, transparent);

预期是什么?

生成结果:

background-color: rgba(蓝色rgb, 0.3);

实际发生了什么?

生成了 tailwind v4 版本的 oklab 颜色

运行环境


其他附加信息

No response

chioio avatar Apr 09 '25 07:04 chioio

Fixed in 4.1.5 https://github.com/sonofmagic/weapp-tailwindcss/pull/629

sonofmagic avatar Apr 09 '25 16:04 sonofmagic

@chioio 但是这种行为会导致使用透明度 + css 变量的时候,被回滚到固定的颜色值,因为微信小程序不支持 color-mix,同时 tailwindcss 依赖 color-mix + css var 来进行颜色变量的计算。 这也算是小程序上不得已做出的牺牲吧,希望以后小程序能够支持更多的 CSS 特性

sonofmagic avatar Apr 11 '25 03:04 sonofmagic