You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何从color.new()生成的颜色变量中提取无透明度的纯色值

解决方案

你可以直接使用 Pine Script 内置的 color.strip_alpha() 函数剥离颜色的透明度通道,直接获取无透明度的纯色值,对应代码如下:

pureOrange = color.strip_alpha(orangeWith80Transp)

补充说明

如果你需要手动实现这个逻辑,也可以先提取目标颜色的RGB三个分量,再重新生成透明度为0的纯色:

// 手动提取RGB分量后重新生成纯色
r = color.r(orangeWith80Transp)
g = color.g(orangeWith80Transp)
b = color.b(orangeWith80Transp)
pureOrange = color.rgb(r, g, b)

color.rgb() 生成的颜色默认透明度为0,无需额外指定透明度参数。

内容的提问来源于stack exchange,提问作者bbnm

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.10.07 18:21:00